Я пробовал использовать Swift версии 4.2 и 5.0, и у меня был тот же результат. Xcode сообщает об ошибках при инициализации и использовании объектов Swift из кода Objective- C. Библиотека SwiftR обновлена. Используйте Xcode 11.5
@import SwiftR;
@interface CHSignalrService ()
@property (strong, nonatomic) SignalR *srConnection;
@property (strong, nonatomic) Hub * chatHub;
@property (strong, nonatomic) Hub * orderHub;
@property (strong, nonatomic) Hub * onlineInterpreterHub;
@end
@implementation CHSignalrService
#pragma makr - Lifecycle
- (void)startConnectionWithAccessToken:(NSString *)at {
if (self.srConnection != nil) {
return;
}
//below is error: No visible @interface for 'SignalR' declares the selector 'init:connectionType:'
self.srConnection = [[SignalR alloc] init:kSignalRBaseURLString connectionType:ConnectionTypeHub];
NSMutableDictionary *headersDict = [[NSMutableDictionary alloc] initWithDictionary:@{@"Authorization":at, @"Content-Type":@"application/json"}];
//below is error: Property 'headers' not found on object of type 'SignalR *'
self.srConnection.headers = headersDict;
//below is error: No visible @interface for 'Hub' declares the selector 'init:'
self.onlineInterpreterHub = [[Hub alloc] init:@"OnlineInterpreterHub"];
[self.onlineInterpreterHub on:@"interpreterConnected" callback:^(NSArray * array) {
[[NSNotificationCenter defaultCenter] postNotificationName:kOnlineInterpreterNotification object:array];
}];
self.chatHub = [[Hub alloc] init:@"ChatHub"];
__weak typeof(self)weakSelf = self;
[self.chatHub on:@"NobodyAnswered" callback:^(NSArray * array) {
[weakSelf NobodyAnswered:nil];
}];
}