'call swift delegate in obj-c

I am trying to port an old obj-c application to swift, and in the process restructure and reprogramm everything. Some things need to be portet at a later point and I have to use old obj-c in swift, which isn't a problem, but I ran into a serious issue which seems like i cannot solve.

I have a obj-c "connection" class which is called from a swift wrapper. The problem is, i cannot pass the delegate object to obj-c or at least i dont know how.

Here is my code:

//swift protocol

@objc protocol ConnectionDelegate
{
    @objc func connected() -> Void
}

//swift class

@objc class ConnectionManager : NSObject, ConnectionDelegate
{
    var connectionThread : ConnectionThread
    init(){
        connectionThread.inti()
        connectionThread.registerDelegate(self) //Value of type 'ConnectionThread' has no member of 'registerDelegate'
        connectionThread.testFunc() //all ok
    }

    @objc func connected(){
    }
}

//obj-c header ConnectionThread.h

@class ConnectionDelegate;

@property (nonatomic, weak) ConnectionDelegate* delegate;

-(void) registerDelegate: (ConnectionDelegate*) delegate;
-(void) testFunc;


//obj-c class ConnectionThread.h

#import ".....Swift.h"

@synthesize delegate;

-(void) registerDelegate:(ConnectionDelegate*) delegate
{
    self.delegate = delegate;
}

-(void) testFunc
{
    
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source