If i set the timeInterval to less than 0.1 , UI starts blocking, combo box does not update,
can not select items in combo box, etc.
This is just to get to know the macos environment better. Like to experiment things. I like to make it real fast. How can i do that?.
this runs in swift cocoa project.
aTimer = Timer.scheduledTimer(timeInterval: 0.1, target: self, selector:
#selector(afunction), userInfo: nil, repeats: true)
@objc func afunction() {
DispatchQueue.global(qos:.background).async {
self.semaphore.wait()
*here -- call some C function to do background processing and return*
//update UI
DispatchQueue.main.async {
self.cbbox.removeAllItems()
if let n = N {
for i in 0 ..< n.pointee { // n elements
self.cbbox.addItem(//insert ...)
self.cbbox.selectItem(at: 0)
self.cbbox.reloadData()