Skip to content

Commit d608282

Browse files
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.
1 parent bd59875 commit d608282

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Sources/X509/Extension Types/NameConstraints.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import SwiftASN1
2323
/// Restrictions are defined in terms of both permitted and forbidden subtrees. The forbidden trees
2424
/// are consulted first, and if a name is matched in a forbidden tree then it does not matter whether
2525
/// the same name is also matched in a permitted tree.
26+
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
2627
public struct NameConstraints {
2728
public struct DNSNames: Hashable, Sendable, Collection, ExpressibleByArrayLiteral, CustomStringConvertible {
2829
public typealias Element = String
@@ -689,10 +690,13 @@ extension Hasher {
689690
}
690691
}
691692

693+
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
692694
extension NameConstraints: Hashable {}
693695

696+
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
694697
extension NameConstraints: Sendable {}
695698

699+
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
696700
extension NameConstraints: CustomStringConvertible {
697701
public var description: String {
698702
var elements: [String] = []
@@ -712,6 +716,7 @@ extension NameConstraints: CustomStringConvertible {
712716
}
713717
}
714718

719+
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
715720
extension NameConstraints: CustomDebugStringConvertible {
716721
public var debugDescription: String {
717722
return "NameConstraints(\(String(describing: self)))"
@@ -743,6 +748,7 @@ extension NameConstraints: CertificateExtensionConvertible {
743748

744749
// MARK: ASN1 Helpers
745750
@usableFromInline
751+
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
746752
struct NameConstraintsValue: DERImplicitlyTaggable {
747753
@inlinable
748754
static var defaultIdentifier: ASN1Identifier {

Sources/X509/OCSP/OCSPPolicy.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import Foundation
2525
// Swift CI has implicit concurrency disabled
2626
import _Concurrency
2727

28+
@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
2829
public protocol OCSPRequester: Sendable {
2930
/// Called with an OCSP Request.
3031
///

0 commit comments

Comments
 (0)