     
     func read(minBytes: Int, onRead: (result: [UInt8]) -> (), onComplete: (error: Error?) -> ())
     
-    func write(buffer: [UInt8], onWrite: ((unwrittenData: [UInt8]?) -> ())?, onComplete: (error: Error?) -> ())
+    func write(buffer: [UInt8], onWrite: ((unwrittenData: [UInt8]?) -> ())?, onComplete: ((error: Error?) -> ())?)
     
 }
 

        }
    }
    
    public func write(buffer: [UInt8], onWrite: ((unwrittenData: [UInt8]?) -> ())? = nil, onComplete: (error: Error?) -> ()) {
        buffer.withUnsafeBufferPointer { buffer in
            
            // Allocate dispatch data
            guard let dispatchData = dispatch_data_create(buffer.baseAddress, buffer.count, dispatch_get_main_queue(), nil) else {
                onComplete(error: .noMemory)
                return
            }
            

                if done {
                    // Writing is complete, check for errors
                    if error != 0 {
                        onComplete?(error: nil)
                    } else {
                        onComplete?(error: Error(rawValue: error))
                    }
                }
            }
