// MARK: - Bridging #if FOUNDATION_FRAMEWORK @available(macOS 10.10, iOS 8.0, watchOS 2.0, tvOS 9.0, *) extension Calendar : ReferenceConvertible { public typealias ReferenceType = NSCalendar } @available(macOS 10.10, iOS 8.0, watchOS 2.0, tvOS 9.0, *) extension Calendar : _ObjectiveCBridgeable { @_semantics("convertToObjectiveC") public func _bridgeToObjectiveC() -> NSCalendar { _calendar.bridgeToNSCalendar() } public static func _forceBridgeFromObjectiveC(_ input: NSCalendar, result: inout Calendar?) { if !_conditionallyBridgeFromObjectiveC(input, result: &result) { fatalError("Unable to bridge \(_ObjectiveCType.self) to \(self)") } } public static func _conditionallyBridgeFromObjectiveC(_ input: NSCalendar, result: inout Calendar?) -> Bool { result = Calendar(reference: input) return true } @_effects(readonly) public static func _unconditionallyBridgeFromObjectiveC(_ source: NSCalendar?) -> Calendar { var result: Calendar? _forceBridgeFromObjectiveC(source!, result: &result) return result! } } @available(macOS 10.10, iOS 8.0, watchOS 2.0, tvOS 9.0, *) extension NSCalendar : _HasCustomAnyHashableRepresentation { // Must be @nonobjc to avoid infinite recursion during bridging. @nonobjc public func _toCustomAnyHashable() -> AnyHashable? { return AnyHashable(self as Calendar) } } #endif // FOUNDATION_FRAMEWORK