We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
type
type(of:)
Swift 4
Xcode 9.0
md5: 5b631c25ff45ffe50aeaa87ad2ef789d
relates to:
Issue Description:
This code worked in Swift 3
func log(_ message: String, _ loggedType: Any? = nil) { var type: String? = nil if let loggedType = loggedType { type = "\(type(of: loggedType))" } ///... log the message and type } log("this is a log", String.self)
In swift 4 I get the following error on `type(of: loggedType)`
Cannot call value of non-function type 'String?'
It seems as if it things `type(of🙂` is trying to call on the variable `type` that I just declared.
The text was updated successfully, but these errors were encountered:
That's correct behavior. type(of:) is just a normal function in the standard library in Swift 4.
Sorry, something went wrong.
You can use Swift.type(of: …) to disambiguate.
Swift.type(of: …)
Comment by Rex Fenley (JIRA)
fancy, thanks 👍
No branches or pull requests
Environment
Swift 4
Xcode 9.0
Additional Detail from JIRA
md5: 5b631c25ff45ffe50aeaa87ad2ef789d
relates to:
Issue Description:
This code worked in Swift 3
In swift 4 I get the following error on `type(of: loggedType)`
It seems as if it things `type(of🙂` is trying to call on the variable `type` that I just declared.
The text was updated successfully, but these errors were encountered: