Type 'NSError' has no member 'errorWith' in swift 4?

It simply means NSError doesn't have errorWith method. If you want to create NSError with any description, try this

let error = NSError(domain: "SomeErrorDomain", code: -2001 /* some error code */, userInfo: ["description": "Can't download video"])