The second parameter, assert, is declared as message: @autoclosure () -> Str or _ message: StaticString . I believe that "Unexpected diagnosis: \(diagnosis)" treated as an expression and @autoclosure , and assertString is just a String variable that cannot be converted to a closure or StaticString .
StaticString can only be done with
static func convertFromExtendedGraphemeClusterLiteral(value: StaticString) -> StaticString static func convertFromStringLiteral(value: StaticString) -> StaticString
I suppose this explains why the quick guide notes that you cannot use string interpolation in assert() since StringInterpolationConvertible no support for StringInterpolationConvertible .
source share