Reputation: 20756
What is the best way to construct NSError
object by myself in Swift? Is it ok to do it at all? I need to pass it to the some delegate function then.
Thanks in advance.
Upvotes: 4
Views: 2273
Reputation: 6342
You can user the constructor of NSError:
let ERROR_CODE = 101
let error = NSError(domain: "my.domain.error", code: ERROR_CODE, userInfo: nil)
Upvotes: 8