Add missing availability annotations to fix iOS, watchOS, and tvOS builds (#233)

### Motivation

Currently this package doesn't build for the non-macOS Apple platforms.
For example, compiling for iOS fails with:

- `error: 'some' return types are only available in iOS 13.0.0 or newer`
- `error: Concurrency is only available in iOS 13.0.0 or newer`

Looks like a few types were missing the availability annotations when
this package switched to using them and dropping the minimum platform
requirement.

### Modifications

- Add missing annotations to restore build.

### Results

- Package now builds on iOS, tvOS, and watchOS.
- `struct NameConstraints`, `struct NameConstraintsValue` are marked
only available on iOS 13+ etc.
- `protocol OCSPRequester` is marked only available on iOS 13+ etc.
This commit is contained in:
Si Beaumont authored and GitHub committed 2025-03-13 10:23:22 +00:00
1 parent bd5987524c
commit d608282ae5
2 files changed
+7

No files matched your search

@@ -23,6 +23,7 @@ import SwiftASN1
/// Restrictions are defined in terms of both permitted and forbidden subtrees. The forbidden trees
/// are consulted first, and if a name is matched in a forbidden tree then it does not matter whether
/// the same name is also matched in a permitted tree.
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
public struct NameConstraints {
public struct DNSNames: Hashable, Sendable, Collection, ExpressibleByArrayLiteral, CustomStringConvertible {
public typealias Element = String
@@ -689,10 +690,13 @@ extension Hasher {
}
}
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension NameConstraints: Hashable {}
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension NameConstraints: Sendable {}
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension NameConstraints: CustomStringConvertible {
public var description: String {
var elements: [String] = []
@@ -712,6 +716,7 @@ extension NameConstraints: CustomStringConvertible {
}
}
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
extension NameConstraints: CustomDebugStringConvertible {
public var debugDescription: String {
return "NameConstraints(\(String(describing: self)))"
@@ -743,6 +748,7 @@ extension NameConstraints: CertificateExtensionConvertible {
// MARK: ASN1 Helpers
@usableFromInline
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
struct NameConstraintsValue: DERImplicitlyTaggable {
@inlinable
static var defaultIdentifier: ASN1Identifier {
+1
View File
@@ -25,6 +25,7 @@ import Foundation
// Swift CI has implicit concurrency disabled
import _Concurrency
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
public protocol OCSPRequester: Sendable {
/// Called with an OCSP Request.
///