PlaceChanger
class PlaceChanger
The PlaceChanger
-
The places configuration
Declaration
Swift
private let placesConfiguration: STLocationRequestController.Configuration.Places
-
OnChangePlace Closure
Declaration
Swift
private let onChangePlace: ChangePlace
-
The random numbers array
Declaration
Swift
private var randomNumbers: [Int]
-
The timer
Declaration
Swift
private var timer: Timer?
-
The places
Declaration
Swift
private lazy var places: [CLLocationCoordinate2D] { get set }
-
Default initializer with places configuration and onChangePlace closure
Declaration
Swift
init(placesConfiguration: STLocationRequestController.Configuration.Places, onChangePlace: @escaping ChangePlace)
Parameters
placesConfiguration
The places configration
onChangePlace
The onChangePlace closure
-
Start PlaceChanger
Declaration
Swift
func start()
-
Stop PlaceChanger
Declaration
Swift
func stop()
-
Change place with random selected place
Declaration
Swift
@objc private func changePlace(timer: Timer?)
Parameters
timer
The timer
-
Get a random Index from an given array without repeating an index
Declaration
Swift
private func randomSequenceGenerator(min: Int, max: Int) -> () -> Int
Parameters
min
min. value
max
max. value
Return Value
random integer (without a repeating random int)