alex
alex

Reputation: 111

iOS delegate method definition syntax

how do I understand the following syntax:

-(void) centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *) advertisementData:.....

so the method name is didDiscoverPeripheral, why central parameter is defined first?

Upvotes: 0

Views: 53

Answers (1)

Tommy
Tommy

Reputation: 100632

The method name is centralManager:didDiscoverPeripheral:advertisementData:.

The first parameter tells you which manager discovered the peripheral. You'd otherwise have no idea who was talking to you. It's standard practice with delegate protocols in case you want to talk back.

Upvotes: 2

Related Questions