swift - Why can't I initialize this struct? -


i want make swift error describes how type of variable coming objective-c wrong. here's how tried define struct:

public struct unexpectedresulttypeerror<expected, actual>: error {     let expected: expected.type     let actual: actual.type      init(expected: expected.type, got actual: actual.type) {         self.expected = expected         self.actual = actual     } } 

i figured fine, can't initialize it:

unexpectedresulttypeerror<string, any>(expected: string.self, got: type(of: serializedresult)) 
cannot invoke initializer type 'unexpectedresulttypeerror<string, any>' argument list of type '(expected: string.type, got: any.type)' 


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -