高效,可控,安全的 Concurrency。
整个 Concurrency 功能的结构和思路 https://github.com/SwiftOldDriver/WWDC21/pull/13#issuecomment-862922860:
struct SampleCollection<C: RandomAccessCollection>: RandomAccessCollection { | |
let storage: C | |
let sampleInterval: Int | |
var startIndex: C.Index { storage.startIndex } | |
var endIndex: C.Index { storage.endIndex } | |
func index(before i: C.Index) -> C.Index { | |
if i == endIndex { | |
return storage.index(endIndex, offsetBy: -storage.count.remainderReportingOverflow(dividingBy: sampleInterval).partialValue) | |
} else { |
var sessions = [] | |
var sessionsNodes = document.querySelectorAll("#sessions section.video-container") | |
for (var i=0;i<sessionsNodes.length;i+=1) { | |
var section = sessionsNodes[i] | |
var date = section.querySelector("section.sticky section section section span span").textContent | |
var sessionsInDateNodes = section.querySelectorAll("ul.videos li.video div.grid div.row") | |
var sessionsInDate = [] | |
高效,可控,安全的 Concurrency。
整个 Concurrency 功能的结构和思路 https://github.com/SwiftOldDriver/WWDC21/pull/13#issuecomment-862922860:
/* | |
See LICENSE folder for this sample’s licensing information. | |
Abstract: | |
Blur Detector Object. | |
*/ | |
import AVFoundation | |
import Accelerate | |
import UIKit |