Skip to content

Commit

Permalink
Support named transformers, set attrType
Browse files Browse the repository at this point in the history
Named transformers should just work too?
Also setting the `attributeType` to
`.transformableAttributeType`.
  • Loading branch information
helje5 committed Feb 16, 2024
1 parent 85ac09a commit f4f8461
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,10 @@ private extension NSAttributeDescription {
case .ephemeral: isTransient = true

case .transformableByName(let name):
fatalError("Not supported")
case .transformableByType(let type):
assert(valueTransformerName == nil)
attributeType = .transformableAttributeType
valueTransformerName = name
case .transformableByType(let type):
let name = NSStringFromClass(type)
if !ValueTransformer.valueTransformerNames().contains(.init(name)) {
// no access to valueTransformerForName?
Expand All @@ -217,6 +218,7 @@ private extension NSAttributeDescription {
.setValueTransformer(transformer, forName: .init(name))
}
valueTransformerName = name
attributeType = .transformableAttributeType

case .allowsCloudEncryption: // FIXME: restrict availability
if #available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *) {
Expand Down

0 comments on commit f4f8461

Please sign in to comment.