Last active
October 3, 2018 19:16
-
-
Save kerker00/63d52c7b0e6a5df1d2bc to your computer and use it in GitHub Desktop.
Self relaunch of Cocoa application (Swift version of https://gist.github.com/cdfmr/2204627)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var task = NSTask() | |
var args: NSMutableArray | |
args = NSMutableArray() | |
args.addObject("-c") | |
args.addObject("sleep 0.2; open \"\(NSBundle.mainBundle().bundlePath())\"") | |
task.setLaunchPath("/bin/sh") | |
task.setArguments(args) | |
task.launch() | |
NSApplication.sharedApplication().terminate(nil) |
Updated for Swift 3 here https://gist.github.com/mortenjust/8ab8eb3774a02ac27c7cefc0af5c5244
is there the a way to this for iOS app?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello! I've updated your Gist for Swift 1.2, new version is here: https://gist.github.com/ericdke/75a42dc8d4c5f61df7d9