Kiran Jasvanee Kiran Jasvanee - 1 year ago 116
Swift Question

Cannot convert value of type 'SecTrustResultType' to expected argument type 'UInt32'

Trying run Swift 2.3 code in Xcode 8.0

var result = SecTrustResultType(rawValue: SecTrustResultType.Invalid)

Answer Source

Invalid is one case of enum SecTrustResultType, but SecTrustResultType(rawValue:) expects a value of the underlying "raw type", in this case UInt32.

So this would compile

var result = SecTrustResultType(rawValue: SecTrustResultType.Invalid.rawValue)

but is just a obfuscated version of the equivalent

// Swift 2.x
var result = SecTrustResultType.Invalid
// Swift 3
var result = SecTrustResultType.invalid
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download