Can we have async inside datastack.perform(asynchronous) #278

Closed
opened 2025-12-29 15:28:07 +01:00 by adam · 1 comment
Owner

Originally created by @seanliu1 on GitHub (Jun 19, 2019).

I would like to make network request inside dataStack.perform. Should we make network request sync so that it can still work.

 self.dataStack.perform(asynchronous: { (transaction) in
            let item = transaction.fetchOne(<Item>())
            item.age = 5
           // fetch id
            URLSession.shared.dataTask(){ 
                 item.id = id 
           }, completionBlock:{  
  })
Originally created by @seanliu1 on GitHub (Jun 19, 2019). I would like to make network request inside dataStack.perform. Should we make network request sync so that it can still work. ``` self.dataStack.perform(asynchronous: { (transaction) in let item = transaction.fetchOne(<Item>()) item.age = 5 // fetch id URLSession.shared.dataTask(){ item.id = id }, completionBlock:{ }) ```
adam added the question label 2025-12-29 15:28:07 +01:00
adam closed this issue 2025-12-29 15:28:07 +01:00
Author
Owner

@JohnEstropia commented on GitHub (Jun 21, 2019):

No, you can either do your transaction only after the network request completes, or do 2 separate transactions for before and after the request

@JohnEstropia commented on GitHub (Jun 21, 2019): No, you can either do your transaction only after the network request completes, or do 2 separate transactions for before and after the request
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/CoreStore#278