LoginSignup
10
13

More than 5 years have passed since last update.

(Swift) OSXでペアリング済みのBluetoothデバイスを列挙する

Last updated at Posted at 2016-05-08

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)
        }
    }

}

参考リンク

10
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
13