Programmatically Screenshot | Swift 3, macOS

Yes its possible. This function takes all connected monitors screenshots and writes to specified path as jpg file. Generates file name as unix time stamp. func TakeScreensShots(folderName: String){ var displayCount: UInt32 = 0; var result = CGGetActiveDisplayList(0, nil, &displayCount) if (result != CGError.success) { print(“error: \(result)”) return } let allocated = Int(displayCount) let activeDisplays = … Read more

Listen to a value change of my text field

You can set a delegate for your NSTextField instance and have the delegate implement the following method: – (void)controlTextDidChange:(NSNotification *)notification { // there was a text change in some control } Your delegate object can be the application delegate, a window controller, a view controller, or some other object in your application. The delegate can … Read more

AVFoundation (AVPlayer) supported formats? No .vob or .mpg containers?

The AVURLAsset class has a static methods that you can query for supported video UTIs: + (NSArray *)audiovisualTypes On 10.9.1 it returns these system defined UTIs: public.mpeg public.mpeg-2-video public.avi public.aifc-audio public.aac-audio public.mpeg-4 public.au-audio public.aiff-audio public.mp2 public.3gpp2 public.ac3-audio public.mp3 public.mpeg-2-transport-stream public.3gpp public.mpeg-4-audio Here is an explanation of system UTIs. So it seems that at least the … Read more

Run a script only at shutdown (not log off or restart) on Mac OS X

Few days ago I published on github a configuration/script able to be executed at boot/shutdown. Basically on Mac OS X you could/should use a System wide and per-user daemon/agent configuration file (plist) in conjunction with a bash script file. This is a sample of the plist file you could use: <?xml version=”1.0″ encoding=”UTF-8″?> <!DOCTYPE plist … Read more

git: command not found (on OS X 10.5)

From the page you linked to: /usr/local/git/bin Is that in your PATH? Open ~/.profile in your favorite editor and add the line export PATH=$PATH:/usr/local/git/bin This appends the item to your PATH variable (separarated by colons), so it’s compatible with other commands that modify the path.

macOS SwiftUI Navigation for a Single View

Here is a simple demo of possible approach for custom navigation-like solution. Tested with Xcode 11.4 / macOS 10.15.4 Note: background colors are used for better visibility. struct ContentView: View { @State private var show = false var body: some View { VStack{ if !show { RootView(show: $show) .frame(maxWidth: .infinity, maxHeight: .infinity) .background(Color.blue) .transition(AnyTransition.move(edge: .leading)).animation(.default) … Read more