Skip to content

Instantly share code, notes, and snippets.

@brocoo
Last active August 29, 2015 14:23
Show Gist options
  • Save brocoo/f1c5221a388caf5ab3a7 to your computer and use it in GitHub Desktop.
Save brocoo/f1c5221a388caf5ab3a7 to your computer and use it in GitHub Desktop.
Swift 1.2 function to flush shared cookies
public func flushCookies() {
let storage = NSHTTPCookieStorage.sharedHTTPCookieStorage()
if let cookieJar = storage.cookies as? [NSHTTPCookie] {
for cookie in cookieJar { storage.deleteCookie(cookie) }
}
NSUserDefaults.standardUserDefaults().synchronize()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment