how to pass paramters using initwith from Objective C to swift

Hi friend,


In Apple's sample code: metronome,


https://developer.apple.com/library/content/samplecode/HelloMetronome/Listings/iOSHelloMetronome_Metronome_swift.html#//apple_ref/doc/uid/TP40017587-iOSHelloMetronome_Metronome_swift-DontLinkElementID_12

We want to pass parameters from ViewController.m within " - (IBAction)buttonPressed:(UIButton*)sender " to Metronome.swift within "

init(withTempo tempo: Float32) {

super.init() "


Besides Tempo, we also want to pass another paramter: timeSignature, we tried the following 3 methods in swift file but all failed:

init(withTempo tempo: Float32, withTimeSign timeSign: Int32)

init(withTempo tempo: Float32, timeSign: Int32)

init(tempo: Float32, timeSign: Int32)

and some methods like following in Objective C file, which also failed:

if (tempo != nil && timeSign != nil) { /

// metronome = [[Metronome alloc] initWithTempo:tempo.floatValue]; this works to pass only one parameter

metronome = [[Metronome alloc] initWithTempo:tempo.floatValue withTimeSign:timeSign.floatValue];

metronome = [[Metronome alloc] initWithTempo:tempo.floatValue timeSign:timeSign.floatValue];

} else {

Please help, thanks!

Guang