Skip to content

Timer Initialising

Alina P edited this page Nov 25, 2024 · 10 revisions

Setup

This page presents various options for incorporating MijickTimer into your application. We begin by outlining the limitations of each method, helping you select the approach that best suits your requirements. While the code examples are based on iOS, they should also be compatible with macOS.

Note

MTimerID structure is used to initialize and register MTimer. It allows to get an access to a specific MTimer from any place in the app.

Step 1: Create Timer ID

It's always possible to initialize MTimerID with using a String value

 MTimerID(rawValue: "Some Timer ID")

Create static MTimerID properties.

We advice to create a static properties to simplify the process of accessing the Timer ID

extension MTimerID {
    static let id1 = MTimerID(rawValue: "Some Timer ID 1")
    static let id2 = MTimerID(rawValue: "Some Timer ID 2")
    static let id3 = MTimerID(rawValue: "Some Timer ID 3")
}

Step 2: Initialize MTimer

Initialising using String value

let id = MTimerID(rawValue: "Some Timer ID")
let timer = MTimer(id)

Initialising using static value

let timer = MTimerID(.id1)

Clone this wiki locally