Created
February 11, 2017 17:35
-
-
Save markd2/f1cd72d269420cb66191de3c09726754 to your computer and use it in GitHub Desktop.
This file contains 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
import Cocoa | |
class ViewController: NSViewController { | |
var timer : Timer? | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
timer = Timer.scheduledTimer(withTimeInterval: 2.0, repeats: true) { timer in | |
self.toggleImage() | |
} | |
} | |
var toggle = true | |
func toggleImage() { | |
let image = NSImage(named: toggle ? "thing1" : "thing2") | |
NSApplication.shared().applicationIconImage = image | |
toggle = !toggle | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment