blob: 9a97bb22448b91bb6a19ab216d242c56f53fec1c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
//
// LVGLSpinner.swift
//
//
// Created by Navan Chauhan on 8/9/24.
//
import CLVGL
public protocol LVGLSpinnerProtocol: LVGLObjectProtocol {
func setAnimation(animationTime: UInt32, arcAngle: UInt32)
}
public struct LVGLSpinner: LVGLSpinnerProtocol {
public var pointer: UnsafeMutablePointer<lv_obj_t>?
public init(
animationTime: UInt32 = 100,
arcAngle: UInt32 = 200, alignment: LVAlignment = .center, xSize: UInt32 = 100,
ySize: UInt32 = 100
) {
guard let spinner = lv_spinner_create(lv_screen_active()) else {
fatalError("Failed to create spinner")
}
self.pointer = spinner
align(alignment: alignment)
setSize(width: 100, height: 100)
lv_spinner_set_anim_params(spinner, 1000, 200)
}
public func setAnimation(animationTime: UInt32 = 1000, arcAngle: UInt32 = 200) {
lv_spinner_set_anim_params(pointer, animationTime, arcAngle)
}
}
|