Skip to content

Swift implementation of RKCLLocationValueTransformer ? #31

@kpavankotesh

Description

@kpavankotesh

I am using RestKit in my swift project and I need value transformers for a particular use case. I was trying to write this in swift as below just as a simple upper case transformer.

func transformValue(_ inputValue: Any?, toValue outputValue: Any?, of outputValueClass: AnyClass) throws -> Bool {
    var outputValue = outputValue
    
    if outputValueClass is String.Type {
      outputValue = (inputValue as? String)?.uppercased()
    }
    
    return true
  }

When I do this, I get this error RKValueTransformer subclasses must provide a concrete implementation of 'transformValue:toValue:ofClass:error:'

How do I write these lines in swift?

RKValueTransformerTestInputValueIsKindOfClass(inputValue, (@[ [NSDictionary class], [CLLocation class] ]), error);

RKValueTransformerTestOutputValueClassIsSubclassOfClass(outputValueClass, (@[ [NSDictionary class], [CLLocation class] ]), error);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions