Skip to content

Instantly share code, notes, and snippets.

// Construct startDate and endDate objects with NSDateComponents.
// See this article for more http://iaintheindie.com/2014/08/08/useful-nsdate-nscalendar-tricks/#StartEnd_of_the_Week
// For more examples of working with HealthKit see https://developer.apple.com/library/content/samplecode/Fit/Introduction/Intro.html
let workoutPredicate = NSPredicate(format: "(%K == %d) OR (%K == %d)",
HKPredicateKeyPathWorkoutType,
HKWorkoutActivityType.functionalStrengthTraining.rawValue,
HKPredicateKeyPathWorkoutType,
HKWorkoutActivityType.traditionalStrengthTraining.rawValue)
import Foundation
import PlaygroundSupport
/// A thread-safe array.
public class SynchronizedArray<Element> {
private let queue = DispatchQueue(label: "io.zamzam.ZamzamKit.SynchronizedArray", attributes: .concurrent)
private var array = [Element]()
public init() { }