高效,可控,安全的 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 |
这篇文章只要概括性说明 Swift 6 今年的更新即可,不需要太过详细,调重点的地方展开去聊聊即可。
文章我建议分成三个部分去编写: