init(domain:code:userInfo:)
Returns an NSError object initialized for a given domain and code with a given userInfo dictionary.
Declaration
init(domain: String, code: Int, userInfo dict: [String : Any]? = nil)Parameters
- domain:
The error domain—this can be one of the predefined
NSErrordomains, or an arbitrary string describing a custom domain.domainmust not benil. SeeError Domainsfor a list of predefined domains. - code:
The error code for the error.
- dict:
The
userInfodictionary for the error.userInfomay benil.
Return Value
An NSError object initialized for domain with the specified error code and the dictionary of arbitrary data userInfo.
Discussion
This is the designated initializer for NSError.