diff --git a/.travis.yml b/.travis.yml index 17ee849..a046bb4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ matrix: - swift test env: - JOB=Linux - - SWIFT_VERSION=3.1-DEVELOPMENT-SNAPSHOT-2017-03-01-a + - SWIFT_VERSION=3.1 sudo: required dist: trusty language: generic diff --git a/Result/Result.swift b/Result/Result.swift index 158e11e..c92524d 100644 --- a/Result/Result.swift +++ b/Result/Result.swift @@ -155,6 +155,7 @@ public func materialize(_ f: @autoclosure () throws -> T) -> Result(_ function: String = #function, file: String = #file, line: Int = #line, `try`: (NSErrorPointer) -> T?) -> Result { var error: NSError? return `try`(&error).map(Result.success) ?? .failure(error ?? Result.error(function: function, file: file, line: line)) @@ -165,6 +166,7 @@ public func `try`(_ function: String = #function, file: String = #file, line: /// This is convenient for wrapping Cocoa API which returns a `Bool` + an error, by reference. e.g.: /// /// Result.try { NSFileManager.defaultManager().removeItemAtURL(URL, error: $0) } +@available(*, deprecated, message: "This will be removed in Result 4.0. Use `Result.init(attempt:)` instead. See https://github.com/antitypical/Result/issues/85 for the details.") public func `try`(_ function: String = #function, file: String = #file, line: Int = #line, `try`: (NSErrorPointer) -> Bool) -> Result<(), NSError> { var error: NSError? return `try`(&error) ?