Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Commit

Permalink
Add @NoEscape to transformations
Browse files Browse the repository at this point in the history
I'm not sure why this wasn't here before, we're obviously not holding on
to these closures.
  • Loading branch information
keith committed Jul 12, 2016
1 parent 72fb80e commit b738e35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

## Enhancements

- None
- Add `@noescape` to transformation closures
[Keith Smiley](https://github.com/keith)
[#60](https://github.com/lyft/mapper/pull/60)

## Bug Fixes

Expand Down
4 changes: 2 additions & 2 deletions Sources/Mapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public struct Mapper {
- returns: The value of type T for the given field
*/
@warn_unused_result
public func from<T>(field: String, transformation: AnyObject? throws -> T) throws -> T {
public func from<T>(field: String, @noescape transformation: AnyObject? throws -> T) throws -> T {
return try transformation(try self.JSONFromField(field))
}

Expand All @@ -374,7 +374,7 @@ public struct Mapper {
otherwise nil
*/
@warn_unused_result
public func optionalFrom<T>(field: String, transformation: AnyObject? throws -> T?) -> T? {
public func optionalFrom<T>(field: String, @noescape transformation: AnyObject? throws -> T?) -> T? {
return (try? transformation(try? self.JSONFromField(field))).flatMap { $0 }
}

Expand Down

0 comments on commit b738e35

Please sign in to comment.