Hi friend,
In Apple's sample code: metronome,
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