By the way, return Never used to be called @noreturn, so you weren't far
off!
On Fri, Mar 24, 2017 at 02:22 Rien via swift-users
wrote:
> Excellent!
>
> Love this list ;-)
>
> Regards,
> Rien
>
> Site: http://balancingrock.nl
> Blog: http://swiftrien.blogspot.com
> Github: http://github.com/Balan
Excellent!
Love this list ;-)
Regards,
Rien
Site: http://balancingrock.nl
Blog: http://swiftrien.blogspot.com
Github: http://github.com/Balancingrock
Project: http://swiftfire.nl
> On 24 Mar 2017, at 10:12, Philip Erickson wrote:
>
> I believe returning Never does what you want, e.g.
>
>
The last line should be `fatalError(findReasonAndTerminate())`.
Zhaoxin
On Fri, Mar 24, 2017 at 5:13 PM, Zhao Xin wrote:
> Change you `func findReasonAndTerminate()` to `func
> findReasonAndTerminate() -> String`.
> Then you can use `fatalError(func findReasonAndTerminate())`.
>
> Zhaoxin
>
>
Change you `func findReasonAndTerminate()` to `func
findReasonAndTerminate() -> String`.
Then you can use `fatalError(func findReasonAndTerminate())`.
Zhaoxin
On Fri, Mar 24, 2017 at 5:02 PM, Rien via swift-users wrote:
> Is there any way to mark a function as “no return”?
>
> Reason: The compi
I believe returning Never does what you want, e.g.
import Foundation
func findReasonAndTerminate() -> Never
{
let reason: String = findReason()
fatalError(reason)
}
func findReason() -> String
{
return "some reason"
}
func buildData() -> Data?
{
return nil
}
guard let data = buildData()
Is there any way to mark a function as “no return”?
Reason: The compiler generates an error when the else block from a guard does
not terminate the execution by either a return or a fatalError. I want to call
out to a function and raise the fatalError in that function.
func findReasonAndTermina