Skip to content

Instantly share code, notes, and snippets.

View embassem's full-sized avatar
🎯
Focusing

Bassem Tourky embassem

🎯
Focusing
View GitHub Profile
/// Indicates whether the app is running from Xcode or
/// the debugger had been attached to a running app from Finder
static var isDebuggerAttached: Bool {
var debuggerIsAttached = false
var name: [Int32] = [CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid()]
var info = kinfo_proc()
var info_size = MemoryLayout<kinfo_proc>.size
let success = name.withUnsafeMutableBytes { (nameBytePtr: UnsafeMutableRawBufferPointer)