Hearst-DD/ObjectMapper — pull request #1 by safx (2014-10-24 15:47:13+00:00)
Title: Custom transform class outside the framework

I would like to create the following custom transform class for my project.

~~~~
class URLTransform: MapperTransform {

override func transformFromJSON(value: AnyObject?) -> ObjectType? {
if let str = value as? String {
return (NSURL(string: str) as ObjectType)
}
return nil
}

override func transformToJSON(value: ObjectType?) -> JSONType? {
if let url = value as? NSURL {
return (url.absoluteString as JSONType)
}
return nil
}
}
~~~~

However, this causes compilation error as follows:

'URLTransform' cannot be constructed because it has no accessible initializers