tePoloN
tePoloN

Reputation: 37

Invalid redeclaration in code converting from Objective-C to Swift

I'm try to convert code from Objective-C to Swift -

Objc-C part - no errors.

AppDelegate:

- (OWTConferenceClient*)conferenceClient{
return _conferenceClient;
}

-(void)conferenceClient:(OWTConferenceClient *)client didReceiveMessage:(NSString *)message from:(NSString *)senderId{
  }

- (void)conferenceClient:(OWTConferenceClient *)client didAddParticipant:(OWTConferenceParticipant *)user{
}

-(void)conferenceClient:(OWTConferenceClient *)client didAddStream:(OWTRemoteStream *)stream{
}

to Swift

AppDelegate:

func conferenceClient() -> OWTConferenceClient {  <--- Error here: Invalid redeclaration of 'conferenceClient()'

return conferenceClient
}

 func conferenceClient(_ client:OWTConferenceClient, didAdd stream:OWTRemoteStream){
}

func conferenceClient(_ client:OWTConferenceClient, didAdd user:OWTConferenceParticipant) {
}

func conferenceClient(_ client:OWTConferenceClient, didReceiveMessage message:String, from senderId:String) {
}

What is wrong with Swift part?

Upvotes: 0

Views: 325

Answers (1)

Andreas Oetjen
Andreas Oetjen

Reputation: 10199

It might be that you have a (global or instance) variable named conferenceClient which then interferes with that function.

You need to rename the variable (in ObjC, it had an underscore _conferenceClient)

Upvotes: 1

Related Questions