I have downloaded a source code from https://github.com/NordicSemiconductor/IOS-nRF-Toolbox and I have added this to my project. Then I have created another class named "scanclassone" in my project and copied the codes in NORScannedPeripheral to scan scanclassone.
Then I have came with an error "Cannot assign value of type '[NORScannedPeripheral]' to type '[scanclassone]'
func centralManagerDidUpdateState(_ central: CBCentralManager) {
guard central.state == .poweredOn else {
print("Bluetooth is porewed off")
return
}
let connectedPeripherals = self.getConnectedPeripherals()
var newScannedPeripherals: [NORScannedPeripheral] = []
connectedPeripherals.forEach { (connectedPeripheral: CBPeripheral) in
let connected = connectedPeripheral.state == .connected
let scannedPeripheral = NORScannedPeripheral(withPeripheral: connectedPeripheral, andIsConnected: connected )
newScannedPeripherals.append(scannedPeripheral)
}
peripherals = newScannedPeripherals
let success = self.scanForPeripherals(true)
if !success {
print("Bluetooth is powered off!")
}
}
I'm using Swift 4