Bluetoothを使う場合は、
- IOBluetooth
- CoreBluetooth
のうち、どちらかをimportする必要があるようです。
ここではIOBluetoothの方の機能を使っています。
import Cocoa
import IOBluetooth
class ViewController: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
for i in IOBluetoothDevice.pairedDevices() {
let device = i as! IOBluetoothDevice
print("device: ", device.name)
}
}
}