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
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
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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.
@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