Skip to content

Instantly share code, notes, and snippets.

@JamalK
Last active October 13, 2022 06:16
Show Gist options
  • Save JamalK/c104cb38f52813c0fddd to your computer and use it in GitHub Desktop.
Save JamalK/c104cb38f52813c0fddd to your computer and use it in GitHub Desktop.
FaceTime from command line.
#!/usr/bin/env swift
//swiftc facetime_cli.swift -o facetime_cli
// sudo cp facetime_cli /usr/bin
// Enjoy! usage: facetime_cli $PHONE_NUMBER or $APPLE_ID
import Foundation
import Cocoa
extension Array {
func safeObjectAt(index: Int) -> Element? {
if index < self.count {
return self[index]
}
else {
return nil
}
}
}
if let address = Process.arguments.safeObjectAt(1) where address.characters.count > 0 {
let url: String = "tel://\(address)"
print("Calling \(address)...")
NSWorkspace.sharedWorkspace().openURL(NSURL(string: url)!)
} else {
print("Please supply an address to call")
}
@gniemetz
Copy link

Successfully built it with xcrun -sdk macosx swiftc facetime_cli.swift -o facetime_cli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment