Hesham Ali Kamal
Hesham Ali Kamal

Reputation: 261

Translating method signatures from Objective-C to Swift

Currently I'm translating a class from Objective-C to apple Swift, but unfortunately I've no idea about Objective-C so any help in translating the signature of the following function from Objective-C to Swift?

- (void)playbackSession:(id<BCOVPlaybackSession>)session didReceiveLifecycleEvent:(BCOVPlaybackSessionLifecycleEvent *)lifecycleEvent

Upvotes: 2

Views: 2167

Answers (2)

Zedenem
Zedenem

Reputation: 2559

Upping this question to provide a more generic answer:

  • Use the "Related Items" button on the top left of your code window in XCode (right next to the "<" and ">" navigation arrows)
  • From the menu it opens, select "Generated interface" and choose your Swift version of choice. Voilà!

See capture of the "Related items" menu:

Related Items menu in XCode

Upvotes: 8

ZeMoon
ZeMoon

Reputation: 20274

The signature in Swift would look like:

func playbackSession(session: AnyObject<BCOVPlayBackSession>!, didReceiveLifecycleEvent event:BCOVPlaybackSessionLifecycleEvent!)

Upvotes: 2

Related Questions