2

I have downloaded Xcode 10.2 beta release. I am trying to use new Result type in Application project or Playground with Swift 5 enabled.

My code is as below:

import UIKit

enum SampleError: Error {
    case foo
}

func bar() -> Result<Int, SampleError> {

}

When compiling I am getting:

Use of undeclared type 'Result'

I have double checked settings and verified with below code that I am using Swift 5.0

    #if swift(>=5.0)
    print("Hello, Swift 5.0")
    #endif

Does anybody encountered similar issue?

Cœur
  • 37,241
  • 25
  • 195
  • 267
matrejek
  • 400
  • 1
  • 4
  • 15
  • Where is `Result` declared? The compiler says it's not declared at all. – vadian Jan 27 '19 at 20:54
  • 2
    @vadian As it was [added to the stdlib "in Swift 5"](https://github.com/apple/swift-evolution/blob/master/proposals/0235-add-result.md), karmel seems to be expecting it to be declared there. – jscs Jan 27 '19 at 21:23

1 Answers1

4

Update:

Result is now available with Xcode 10.2 beta 2 release. Yay

Here is the link to release note where you can find more details about Swift changes.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Sandeep
  • 20,908
  • 7
  • 66
  • 106
  • Ouch, I missed that! Good point! I was so excited after reading all those articles that I thought it will be available with that release and missed checking the notes. Thanks! – matrejek Jan 27 '19 at 20:58
  • 1
    Actually, since 10.2 beta2 was released, your link now redirects to beta2 release notes page, which does mention `Result` type. @karmel, I think you can download beta2 and try your code again there. – pckill Feb 13 '19 at 15:15