XCTUnwrap

Unwrap the value, or throw an error.

//                  โ•ญโ”€โ”€โญ๏ธโ”€โ”€โ•ฎ
func testUserToken() throws {
    let user = User()
    // if succeeds: get the value, if fails: throw an exception.
    let token = try XCTUnwrap(user.getToken())    // โญ๏ธ can throw
    XCTAssertEqual(token.count, 40)
}

Last updated