0

This is Objective C method in YouTubeHelper class,

- (id)initWithDelegate:(id <YouTubeHelperDelegate>)delegate {
    self = [super init];

    self.delegate = delegate;
    [self initYoutubeService];

    return self;
}

I wanna call it in swift class,

override init() {
        self.youTubeHelper = YouTubeHelper()
        }

How can I do this?

rishu1992
  • 1,414
  • 3
  • 14
  • 33
  • 2
    I've written a tutorial that teaches you to perform this translation yourself: http://www.apeth.com/swiftBook/apa.html#_objective_c_initializers_and_factories – matt Jan 29 '15 at 05:33

1 Answers1

0

It will probably be (if the delegate is self):

self.youTubeHelper = YouTubeHelper(delegate:self)

Jacob Gorban
  • 1,431
  • 1
  • 9
  • 15
  • It gives error "self used before super.init call" And when I add super.init() before self.youTubeHelper = YouTubeHelper(delegate:self),i get error "self.youTbeHelper not initialize at super.init call". – rishu1992 Jan 29 '15 at 05:58
  • Is the Swift code with init() a subclass of that YouTubeHelper Objective-C class? If not, why is it an override? – Jacob Gorban Jan 29 '15 at 20:41