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

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

Ansible warning on jinja2 braces on when -

html - How to custom Bootstrap grid height? -