Bugs: After upgrading to Realm 4.0 for Swift, enum are not supported as they used to
enum to be supported as it was in version 3.21.0
*** Terminating app due to uncaught exception 'RLMException', reason: 'Property UserCard.cardType is declared as CardType, which is not a supported managed Object property type. If it is not supposed to be a managed property, either add it toignoredProperties()or do not declare it as@objc dynamic. See https://realm.io/docs/swift/latest/api/Classes/Object.html for more information.'
Enum is defined the following way
@objc enum CardType: Int {
case type1
case type2
case type3
}
final class UserCard: Object {
@objc dynamic var cid: String?
@objc dynamic var cardType: CardType = .type3
@objc dynamic var created_at = Int()
@objc dynamic var updated_at = Int()
@objc dynamic var md5: String?
override static func primaryKey() -> String? {
return "cid"
}
}
Realm framework version: 4.0.0
Xcode version: 11.2.1
iOS/OSX version: 12.1
Dependency manager + version: cocoapod 1.8.4
The same problem is here =((((
This is one of those things that worked by coincidence rather than being intentionally supported, and so broke when changing things. https://github.com/realm/realm-cocoa/pull/6343 adds explicit support for @objc enum properties, although the enum will need to explicitly conform to the RealmEnum protocol (which doesn't require defining any methods).
➤ Unito Sync Bot commented:
Transition made by Unito
This is one of those things that worked by coincidence rather than being intentionally supported, and so broke when changing things. #6343 adds explicit support for
@objc enumproperties, although the enum will need to explicitly conform to theRealmEnumprotocol (which doesn't require defining any methods).
This would be great to add to the Change Log or Release Notes. I had to follow some breadcrumbs to get here and discover the existence of RealmEnum.
Most helpful comment
This would be great to add to the Change Log or Release Notes. I had to follow some breadcrumbs to get here and discover the existence of RealmEnum.