Skip to content

Instantly share code, notes, and snippets.

@mhorga
Last active July 21, 2020 05:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhorga/602949a37d58ee68bc5ca281a504d31c to your computer and use it in GitHub Desktop.
Save mhorga/602949a37d58ee68bc5ca281a504d31c to your computer and use it in GitHub Desktop.
import Cocoa
class ViewController: NSViewController {
@IBOutlet weak var label: NSTextField!
override func viewDidLoad() {
super.viewDidLoad()
let devices = MTLCopyAllDevices()
guard let _ = devices.first else {
fatalError("Your GPU does not support Metal!")
}
label.stringValue = "Your system has the following GPU(s):\n"
for device in devices {
label.stringValue += "\(device.name)\n"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment