Skip to content

Instantly share code, notes, and snippets.

@cezheng
Last active June 15, 2016 12:44
Show Gist options
  • Select an option

  • Save cezheng/bc68cc72594fb9f55d4dfd2fe532642f to your computer and use it in GitHub Desktop.

Select an option

Save cezheng/bc68cc72594fb9f55d4dfd2fe532642f to your computer and use it in GitHub Desktop.
Setting default browser on OSX (swift 2.2)
#!/usr/bin/swift
import Foundation
import CoreServices
let bundleId: CFString = "xxx.xxx.xxx" as NSString
LSSetDefaultHandlerForURLScheme("http" as NSString, bundleId)
LSSetDefaultHandlerForURLScheme("https" as NSString, bundleId)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment