You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm wondering why optional chaining (in a Swift project, integrated with CocoaPods) always fails by returning nil. However, step-by-step (or chaining done in the debugger) works. For example, try this:
let set = JWTClaimsSet()
set.issuer = "testIssuer"
set.subject = "testSubjectx"
let secret = "aaabbbcccddd"
let heads = ["customKey": "customValue"]
let algo = JWTAlgorithmHSBase.algorithm384()
let e = JWTBuilder.encode(set)!
let h = e.headers(heads)!
let s = h.secret(secret)!
let b = s.algorithm(algo)!
let enc = b.encode
guard let encoded = enc else {
fatalError("No encoded")
}
print(encoded) // succeeds
print("success") // note that if we insert a breakpoint here and run `po JWTBuilder.encode(set)?.headers(heads)?.secret(secret)?.algorithm(algo)?.encode` we get a non-nil value
guard let encoded2 = JWTBuilder.encode(set)?.headers(heads)?.secret(secret)?.algorithm(algo)?.encode else {
fatalError("No encoded 2") // fails
}
print(encoded2)
Note that this only happens in Xcode 10 (not 9) so maybe it's a compiler bug?
The text was updated successfully, but these errors were encountered:
@MarcoFiletti@michaelspecht
Hi!
I have figure out what is going on. It is a swift correct behavior with fluent-ish blocks that captures weakSelf.
It is fixed in latest master for Version 3 only.
Issue Info
Issue Description and Steps
Hello, I'm wondering why optional chaining (in a Swift project, integrated with CocoaPods) always fails by returning nil. However, step-by-step (or chaining done in the debugger) works. For example, try this:
Note that this only happens in Xcode 10 (not 9) so maybe it's a compiler bug?
The text was updated successfully, but these errors were encountered: