Return Value 戻り値
The success value, if the instance represents a success. 成功値、もしインスタンスが成功を表すならば。
Availability
Technology
func get() throws -> Success
The success value, if the instance represents a success. 成功値、もしインスタンスが成功を表すならば。
Use this method to retrieve the value of this result if it represents a success, or to catch the value if it represents a failure. このメソッドを使うことで、この結果の値を回収してください、もしそれが成功を表すならば、またはそれが失敗を表すならばその値をキャッチしてください。
let integerResult: Result<Int, Error> = .success(5)
do {
let value = try integerResult.get()
print("The value is \(value).")
} catch {
print("Error retrieving the value: \(error)")
}
// Prints "The value is 5."