eachPair without AnySequence
extension Sequence where Self.SubSequence: Sequence {
func eachPair() -> Zip2Sequence<Self, Self.SubSequence> {
return zip(self, self.dropFirst())
}
}
(1...10).eachPair().forEach { print($0) }| { | |
| "crashDiagnostics" : [ | |
| { | |
| "version" : "1.0.0", | |
| "callStackTree" : { | |
| "callStacks" : [ | |
| { | |
| "threadAttributed" : true, | |
| "callStackRootFrames" : [ | |
| { |
eachPair without AnySequence
extension Sequence where Self.SubSequence: Sequence {
func eachPair() -> Zip2Sequence<Self, Self.SubSequence> {
return zip(self, self.dropFirst())
}
}
(1...10).eachPair().forEach { print($0) }| import Foundation | |
| final class SafeSyncQueue { | |
| struct QueueIdentity { | |
| let label: String | |
| } | |
| let queue: DispatchQueue | |
| i386 : iPhone Simulator | |
| x86_64 : iPhone Simulator | |
| arm64 : iPhone Simulator | |
| iPhone1,1 : iPhone | |
| iPhone1,2 : iPhone 3G | |
| iPhone2,1 : iPhone 3GS | |
| iPhone3,1 : iPhone 4 | |
| iPhone3,2 : iPhone 4 GSM Rev A | |
| iPhone3,3 : iPhone 4 CDMA | |
| iPhone4,1 : iPhone 4S |
| NSFont *normalFont = [NSFont systemFontOfSize:12]; | |
| CGRect renderFrame = CGRectMake(0, 0, 300, 50); // box to render the text into | |
| static NSLayoutManager *layMan = nil; | |
| if (!layMan) { | |
| layMan = [NSLayoutManager new]; | |
| } | |
| CGFloat lineHeight = [layMan defaultLineHeightForFont:normalFont]; // calculate the expected height of a line | |
| NSDictionary *attrDict = [NSDictionary dictionaryWithObject:normalFont andKey:NSFontAttributeName]; |