Avatar ·

¿Qué es @selector() en Swift y cómo usarlo con NSTimer?

¡Hola a todos! Soy un desarrollador iOS principiante y estoy migrando de Objective-C a Swift. Antes en Objective-C usaba activamente @selector() para trabajar con timers y target-action, por ejemplo: ```objc [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateTimer:) userInfo:nil repeats:YES]; ``` Ahora intento hacer lo mismo en Swift, pero el compilador se queja cuando escribo: ```swift let timer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: @selector(updateTimer:), userInfo: nil, repeats: true) ``` Error: `Use of unresolved identifier 'updateTimer'`. Entiendo que en Swift algo cambió con los selectores, pero no puedo entender cómo hacerlo correctamente.