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
Post a Comment