From b6cf465a742c74465dd4c03efe69bb4715611fe3 Mon Sep 17 00:00:00 2001 From: Susan Cheng Date: Tue, 12 Apr 2022 17:50:09 +0800 Subject: [PATCH] Sendable --- Sources/DoggieCore/Concurrency/Sendable.swift | 61 +++++++++++++++++++ Sources/DoggieCore/Json/JsonNumber.swift | 2 +- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 Sources/DoggieCore/Concurrency/Sendable.swift diff --git a/Sources/DoggieCore/Concurrency/Sendable.swift b/Sources/DoggieCore/Concurrency/Sendable.swift new file mode 100644 index 00000000..680a8f2d --- /dev/null +++ b/Sources/DoggieCore/Concurrency/Sendable.swift @@ -0,0 +1,61 @@ +// +// Sendable.swift +// +// The MIT License +// Copyright (c) 2015 - 2022 Susan Cheng. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +#if compiler(>=5.5.2) && canImport(_Concurrency) + +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +extension URL: @unchecked Sendable { } + +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +extension URLComponents: @unchecked Sendable { } + +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +extension Data: @unchecked Sendable { } + +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +extension Date: @unchecked Sendable { } + +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +extension DateComponents: @unchecked Sendable { } + +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +extension TimeZone: @unchecked Sendable { } + +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +extension Calendar: @unchecked Sendable { } + +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +extension Locale: @unchecked Sendable { } + +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +extension UUID: @unchecked Sendable { } + +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +extension OrderedSet: @unchecked Sendable where Element: Sendable { } + +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +extension OrderedDictionary: @unchecked Sendable where Key: Sendable, Value: Sendable { } + +#endif diff --git a/Sources/DoggieCore/Json/JsonNumber.swift b/Sources/DoggieCore/Json/JsonNumber.swift index b3d7b793..212d8a4c 100644 --- a/Sources/DoggieCore/Json/JsonNumber.swift +++ b/Sources/DoggieCore/Json/JsonNumber.swift @@ -41,7 +41,7 @@ extension Json { #if compiler(>=5.5.2) && canImport(_Concurrency) @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) -extension Json.Number: @unchecked Sendable { } +extension Json.Number: Sendable { } #endif