Skip to content

Instantly share code, notes, and snippets.

@mhorga
Last active Jul 21, 2020
Embed
What would you like to do?
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