You need discover the services and characteristic
You don't need read value from the characteristic before writing over it.
will continue for, for this example, after read value. Modify func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?)...