Swift : session sendData , type () does not confirm to protocol BooleanType

100 Views Asked by At

I am trying to create a Bluetooth chat system based on this tutorial : http://www.appcoda.com/chat-app-swift-tutorial/

The error that I receive is the following : type () does not conform to protocol BooleanType.

Does anyone know how to solve this?

enter image description here

    func sendData(dictionaryWithData dictionary: Dictionary<String, String>, toPeer targetPeer: [MCPeerID]){
    let dataToSend = NSKeyedArchiver.archivedDataWithRootObject(dictionary)
    //let peersArray = NSArray(object: targetPeer)


    if session.sendData(dataToSend, toPeers: targetPeer , withMode: MCSessionSendDataMode.Reliable) {

    }


}
1

There are 1 best solutions below

0
On

Well the error states that you use a var as a bool, while it is not a bool, my advice, stop using non type specific inits.

example:

var myBool = true //BAD
var mySecondBool : Bool = true //Good

The thing is I see no bools in the code you posted...