How to override a buttons action using a if else statement

My code below is a timer. Once 2 seconds is reached a button appears. Right now if you press the button disappears forever. I would like the button to reappear after 10 seconds. After 10 seconds is passed I would like to override the action of making the button disappear if selected within the 2 and 9 range. So if someone hits a button between 2 and 9 seconds. I would like the button to automatically reappear after 10 seconds.

import UIKit
class ViewController: UIViewController {
@IBOutlet var Rest: UIButton!
@IBOutlet var start: UIButton!
var timer = Timer()
var counter = 0.0
var isRunning = false

 @IBOutlet var dx: UILabel!
 override func viewDidLoad() {
      dx.text = "\(counter)"
start.isEnabled = true
 @IBAction func play(_ sender: Any) {
if !isRunning{
    timer = Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(ViewController.updateTimer), userInfo: nil, repeats: true)

    start.isEnabled = false

    isRunning = true
 @IBAction func disaper(_ sender: Any) {

Rest.isHidden = true


 func updateTimer(){
counter += 0.1

dx.text = String(format: "%.1f", counter)

if counter > 2 && counter < 9
    Rest.alpha = 1
    Rest.isEnabled = true

} else if counter > 10  {
    Rest.alpha = 1
    Rest.isEnabled = true

else {
    Rest.alpha = 0
    Rest.isEnabled = false


Just so I understand:

Two seconds after the program starts a button appears. It does not disappear unless pressed, but when pressed it disappears. After disappearing it will reappear ten seconds later. This continues indefinitely.

Is that what you need?

@zalubski Do you still need help with this or have you actually solved it in the meantime after all?