Closed automactic closed 3 years ago
!!! MANDATORY TO FILL OUT !!!
It would be great to make it possible to add index to a swift enum property. (Or if someone can confirm we have no plan to support this)
Make it possible to use @Persisted(indexed: true) var property: EnumType with enum EnumType: String/Int/..., PersistableEnum.
@Persisted(indexed: true) var property: EnumType
enum EnumType: String/Int/..., PersistableEnum
An compile error was produced: Referencing initializer 'init(wrappedValue:indexed:)' on 'Persisted' requires that 'EnumType' conform to '_Indexable'
Referencing initializer 'init(wrappedValue:indexed:)' on 'Persisted' requires that 'EnumType' conform to '_Indexable'
class Entity: Object { @Persisted(indexed: true) var category: Category enum Category: String, PersistableEnum { case a, b, c, d } }
Realm framework version: 10.12
Xcode version: 12.5.1
iOS/OSX version: iOS 14.7
Dependency manager + version: SwiftPackageManager
This should be pretty trivial to allow and not supporting it was just an oversight.
Thanks for your super quick response, that's what I thought.
!!! MANDATORY TO FILL OUT !!!
Goals
It would be great to make it possible to add index to a swift enum property. (Or if someone can confirm we have no plan to support this)
Expected Results
Make it possible to use
@Persisted(indexed: true) var property: EnumType
withenum EnumType: String/Int/..., PersistableEnum
.Actual Results
An compile error was produced:
Referencing initializer 'init(wrappedValue:indexed:)' on 'Persisted' requires that 'EnumType' conform to '_Indexable'
Steps for others to Reproduce
Code Sample
Version of Realm and Tooling
Realm framework version: 10.12
Xcode version: 12.5.1
iOS/OSX version: iOS 14.7
Dependency manager + version: SwiftPackageManager