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 MetalLayer: CAMetalLayer { | |
unowned var common: MacCommon | |
override var device: MTLDevice? { | |
didSet{ | |
if oldValue == nil { | |
//clearBuffer() | |
} |
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 | |
import OpenGL.GL | |
import OpenGL.GL3 | |
extension NSDeviceDescriptionKey { | |
static let screenNumber = NSDeviceDescriptionKey("NSScreenNumber") | |
} | |
extension NSScreen { |
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 | |
extension NSTouchBarItem.Identifier { | |
static let sliderTest = NSTouchBarItem.Identifier("test.bar.slider") | |
} | |
extension NSTouchBar.CustomizationIdentifier { | |
static let testBar = NSTouchBar.CustomizationIdentifier("test.bar") | |
} |
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
// call like "swift remote.swift" | |
import MediaPlayer | |
let centre = MPRemoteCommandCenter.shared() | |
let handler: (String) -> ((MPRemoteCommandEvent) -> (MPRemoteCommandHandlerStatus)) = { (name) in | |
return { (event) -> MPRemoteCommandHandlerStatus in | |
print("\(name)") | |
return .success | |
} |
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
// swift -swift-version 3 display_test.swift | |
import Cocoa | |
func model() { | |
var size = 0 | |
sysctlbyname("hw.model", nil, &size, nil, 0) | |
if size <= 0 { | |
print("Model: unknown") | |
} else { |