Questions tagged [dispatch-queue]
231 questions
0
votes
2 answers
Replaying mouse movements with DispatchQueue is laggy
I've recorded a mouse movement (the movement file is here) in the form of (x,y,delay_in_ms) array and I'm trying to replay it back like this:
for movement in movements {
DispatchQueue.global().asyncAfter(deadline: .now() +…

eeeeeeeeeeeeeeeeeeeeeeeeeeeeee
- 634
- 1
- 6
- 20
0
votes
0 answers
In an IOS/Swift project, how can you prevent the processes of a page from overwhelming the page it transitions towards?
What I mean is you are on page A. A button press segues via Navigation Controller to page B. The processes on page A are very intensive and overwhelm page B to the point that it produces wrong UI results (duplicate cells or missing cells)
I have…

florida27
- 67
- 1
- 7
0
votes
0 answers
How can I repeat an action every 30 seconds in SpriteKit?
In my SpriteKit project I would like to toggle a variable for a second and then untoggle it, every 30 seconds:
This is how I handle the timer:
override func didMove(to view: SKView) {
DispatchQueue.main.asyncAfter(deadline: .now(), execute: {
…

Fabez
- 332
- 1
- 12
0
votes
1 answer
I create an instance of 3 different view models and assign each to a state object. How do I place this into a dispatch queue?
I have a Swift program that works as desired. I have 3 view models that each call a separate model. Each model calls a function that reads a separate large CSV file, performs some manipulation and returns a data frame. This takes some time and I…

Chris
- 105
- 8
0
votes
0 answers
Image change on button is not reflecting in iOS swift by using for loop
I have a situation where 9 buttons are placed on viewController and making tic-tac-toe function on ios. whenever I am trying to reset button images once the game is finished, button images are not getting reset.
class TicTacToeViewController:…

user1960279
- 494
- 1
- 8
- 24
0
votes
2 answers
How to use OperationQueue to handle URLSessions for an image downloader
I'm trying to create a simple ImageDownloader framework in swift.
What I'd like to achieve:
Able to download images with given URLs
Cache with url string
So fetching just one image is no problem, I just used func dataTask(with url: URL,…

RobotX
- 208
- 2
- 15
0
votes
0 answers
How DispatchQueue.main.sync works
Why does this code crash the app if done on the main queue?
DispatchQueue.main.sync
{
NSLog("Start again")
}
Whereas, if done on any other queue, it works.
private let internalQueue = DispatchQueue(label:…

Ankur Prakash
- 1,417
- 4
- 18
- 31
0
votes
0 answers
How to create a task stack in swift with async/await http-method
I recently changed my http request method to async/await in swift.
func httpRequest(requestType:HTTPRequestType, parameter:Parameter = Parameter()) async throws -> Data {
// do some preparation depending on requestType and parameter,
//…

JacquesNorris
- 93
- 7
0
votes
0 answers
How to fetch newly written objects in coredata
I'm trying to first call one function that saves data from firebase to Coredata, and when it's done executing call another function that takes that data from coredata and uses it. I'm using a dispatchGroup and this is my code:
let dispatchGroup =…

Pontus
- 44
- 13
0
votes
3 answers
Does `DispatchQueue.global().async` make new global queue?
DispatchQueue.global().async {
print("A")
}
DispatchQueue.global().async {
print("B")
}
DispatchQueue.global().async {
print("C")
}
DispatchQueue.global().async {
print("D")
}
let a = DispatchQueue.global()
a.async {
…

Nala
- 37
- 5
0
votes
1 answer
pass back multiple variables on View Controller completion
How can I pass multiple pass back multiple variables on View Controller completion without using structs or classes?
Here is my code that works:
class TimerViewController: UIViewController {
//DELETED UNIMPORTANT CODE
@IBAction func…

Kosh
- 960
- 2
- 13
- 28
0
votes
1 answer
NSOpenPanel, NSSavePanel runModal dismisses immediately with cancel, but only on M1 running 11.4
I have one user who reports that the Open and Save panels have been "auto dismissing". ie the Open Panel dialog appears then immediately dismisses itself, taking the "cancel" path through the code
The file Open menu item is the standard…

greg
- 309
- 1
- 7
0
votes
0 answers
Is this Swift code a race condition or is it executing correctly?
So, I have a post request in my app which relies on the user latitude and longitude already having a value (0,0 is the default for lat,lon so anything EXCEPT this). I run the post request in my didChangeAuthorizationStatus, but I'm not sure if it's…

nickcoding2
- 142
- 1
- 8
- 34
0
votes
1 answer
UIImageView within UITableViewCell not changing image
I'm a bit stuck. I have a custom UIView which contains a timer and an UIImageView, that timer fires at a constant interval and changes the image from an array of images. This custom view works fine and is performant when I embed it within any other…

Brandon Stillitano
- 1,304
- 8
- 27
0
votes
1 answer
Swift UIImageView Firebase DispatchQueue
I am using firebase to save and load my images. I have created a new view in Xcode and am using the same code I have been using to load profile images. Yet, this is now throwing an error saying that the url string is nil. The image url data…

Lukas Bimba
- 817
- 14
- 35