This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
"https://images.pexels.com/photos/67636/rose-blue-flower-rose-blooms-67636.jpeg", | |
"https://cdn5.img.ria.ru/images/148839/96/1488399690.jpg", | |
"https://i.pinimg.com/564x/36/a1/bd/36a1bdea08a849595fd00ae49d6e7c87.jpg", | |
"https://developer.apple.com/swift/images/swift-og.png", | |
"https://cdnimg.rg.ru/img/content/128/35/27/Geofiziki_predupredili_ob_izverzhenii_supervulkana_d_850.jpg", | |
"https://images.pexels.com/photos/67636/rose-blue-flower-rose-blooms-67636.jpeg", | |
"https://cdn5.img.ria.ru/images/148839/96/1488399690.jpg", | |
"https://i.pinimg.com/564x/36/a1/bd/36a1bdea08a849595fd00ae49d6e7c87.jpg", | |
"https://developer.apple.com/swift/images/swift-og.png", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let group = DispatchGroup() | |
let workItemFirst = DispatchWorkItem { | |
print("exec 1st WI") | |
// 1 | |
group.leave() | |
} | |
let workItemSecond = DispatchWorkItem { | |
print("exec 2nd WI") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let workItemFirst = DispatchWorkItem { | |
print("exec 1st WI") | |
// 2 | |
} | |
let workItemSecond = DispatchWorkItem { | |
print("exec 1st WI") | |
// Not called | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let background = DispatchQueue.init(label: "background", qos: .background) | |
// Work takes significant time, such as minutes or hours. | |
let utility = DispatchQueue.init(label: "utility", qos: .utility) | |
// Work takes a few seconds to a few minutes. | |
let `default` = DispatchQueue.init(label: "default", qos: .default) | |
// The priority level of this QoS falls between user-initiated and utility. This QoS is not intended to be used by developers to classify work. Work that has no QoS information assigned is treated as default, and the GCD global queue runs at this level. | |
let userInitiated = DispatchQueue.init(label: "userInitiated", qos: .userInitiated) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DispatchQueue.init(label: "defaultQos").async { | |
print("async defaultQos exec") | |
// 2 | |
DispatchQueue.main.async { | |
print("async main exec") | |
// 3 | |
} | |
} | |
print("sync main exec") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let concurent = DispatchQueue.init(label: "defaultQos", attributes: .concurrent) | |
concurent.sync { | |
print("sync defaultQos exec") | |
// 1 | |
} | |
concurent.sync { | |
print("sync defaultQos exec") | |
// 2 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DispatchQueue.init(label: "defaultQos").sync { | |
print("sync defaultQos exec") | |
// 1 | |
} | |
DispatchQueue.init(label: "defaultQos").async { | |
print("async defaultQos exec") | |
// 3 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<JsonCoddableUrlSession.ViewController: 0x7fc17051ac40> retrive flights: [JsonCoddableUrlSession.FlightData(Airline: "AEROFLOT", Flight: "SU1834", ActualTime: ""), JsonCoddableUrlSession.FlightData(Airline: "AEROFLOT", Flight: "SU1838", ActualTime: ""), JsonCoddableUrlSession.FlightData(Airline: "BELAVIA", Flight: "B2776", ActualTime: ""), JsonCoddableUrlSession.FlightData(Airline: "BELAVIA", Flight: "B2936", ActualTime: ""), JsonCoddableUrlSession.FlightData(Airline: "BELAVIA", Flight: "B2736", ActualTime: ""), JsonCoddableUrlSession.FlightData(Airline: "BELAVIA", Flight: "B2848", ActualTime: ""), JsonCoddableUrlSession.FlightData(Airline: "BELAVIA", Flight: "B2944", ActualTime: ""), JsonCoddableUrlSession.FlightData(Airline: "BELAVIA", Flight: "B2954", ActualTime: "") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
repository.getFlights(.remote) { (result) in | |
switch result { | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
let repository = Repository(apiClient: APIClient(), database: Database()) | |
... |