RealmConfiguration.swift 904 B

12345678910111213141516171819202122232425262728
  1. //
  2. // RealmConfiguration.swift
  3. // NotificationServiceExtension
  4. //
  5. // Created by huangfeng on 2024/5/29.
  6. // Copyright © 2024 Fin. All rights reserved.
  7. //
  8. @_exported import RealmSwift
  9. import UIKit
  10. let kRealmDefaultConfiguration = {
  11. let groupUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.bark")
  12. let fileUrl = groupUrl?.appendingPathComponent("bark.realm")
  13. let config = Realm.Configuration(
  14. fileURL: fileUrl,
  15. schemaVersion: 13,
  16. migrationBlock: { _, oldSchemaVersion in
  17. // We haven’t migrated anything yet, so oldSchemaVersion == 0
  18. if oldSchemaVersion < 1 {
  19. // Nothing to do!
  20. // Realm will automatically detect new properties and removed properties
  21. // And will update the schema on disk automatically
  22. }
  23. }
  24. )
  25. return config
  26. }()