Latest 0.2.7
Homepage https://github.com/protspace/YESBluetoothDeviceManager
License MIT
Platforms ios 12.0, requires ARC
Authors

YESBluetoothDeviceManager is a tiny package that helps to easily interact with CBPeripheral device.

Usage

Create class property like that:

private var manager: YESBluetoothDeviceManager!

Instantiate a instance of manager:

manager = YESBluetoothDeviceManager(deviceUUID: "CC7E9AC0-217F-C067-5979-17214E50727E",
                                    services: ["D06BBD68-5E35-472E-A1AF-1CCBC360ECA7"],
                                    characteristics: ["B9844A6B-ABCF-47D1-AC2F-8F580F79B153"]) { characteristics in
            print(characteristics)
}

You can also initialize other parameters of the manager:

YESBluetoothDeviceManager(deviceUUID: "CC7E9AC0-217F-C067-5979-17214E50727E",
                                  services: ["D06BBD68-5E35-472E-A1AF-1CCBC360ECA7"],
                                  characteristics: ["B9844A6B-ABCF-47D1-AC2F-8F580F79B153"],
                                  scanTimeOut: 10,
           onTurnedOff: {
            print("Peripheral is turned off")
        }, didDiscoverPeripheral: { peripheral in
            print("Peripheral discovered: (peripheral)")
        }, didFailToDiscoverPeripheral: {
            print("Failed to discover peripheral")
        }, didConnectToPeripheral: { peripheral in
            print("Did Connect To Peripheral: (peripheral)")
        }, didFailToConnectPeripheral: { peripheral in
            print("Did Fail To Connect To Peripheral: (peripheral)")
        }, didDisconnectPeripheral: { peripheral in
            print("Did Disconnect From Peripheral: (peripheral)")
        }, didUpdateCharacteristic: { characteristics in
            print("Did Update Characteristic: (characteristics)")
        })

Use capture lists to avoid retain cycles, i.e.:

... didUpdateCharacteristic: { [weak self] characteristics in
            self?.update(characteristics)
        }

Installing

Cocoapods

  • Add pod 'YESBluetoothDeviceManager', '~> 0.2.7' to your Podfile file’s dependencies.

Contributing

License

This project is licensed under the MIT License – see the LICENSE.md file for details

Latest podspec

{
    "name": "YESBluetoothDeviceManager",
    "platforms": {
        "ios": "12.0"
    },
    "summary": "YESBluetoothDeviceManager helps to interact with BLE devices",
    "requires_arc": true,
    "version": "0.2.7",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Yevgen Sagidulin": "[email protected]"
    },
    "homepage": "https://github.com/protspace/YESBluetoothDeviceManager",
    "source": {
        "git": "https://github.com/protspace/YESBluetoothDeviceManager.git",
        "tag": "0.2.7"
    },
    "source_files": [
        "YESBluetoothDeviceManager/*.swift",
        "YESBluetoothDeviceManager",
        "YESBluetoothDeviceManager/*.{swift}",
        "YESBluetoothDeviceManager/YESBluetoothDeviceManager/*.swift"
    ],
    "swift_version": "4.2"
}

Pin It on Pinterest

Share This