diff --git a/Packages/ClientRuntime/Sources/Util/PlatformOperationSystemVersion.swift b/Packages/ClientRuntime/Sources/Util/PlatformOperationSystemVersion.swift new file mode 100644 index 000000000..8c5802872 --- /dev/null +++ b/Packages/ClientRuntime/Sources/Util/PlatformOperationSystemVersion.swift @@ -0,0 +1,24 @@ +// +// Copyright Amazon.com Inc. or its affiliates. +// All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +#if os(iOS) || os (watchOS) || os(macOS) || os(tvOS) +import Foundation.NSProcessInfo + +public struct PlatformOperationSystemVersion { + static public func operatingSystemVersion() -> String? { + let osVersion = ProcessInfo.processInfo.operatingSystemVersion + return "\(osVersion.majorVersion).\(osVersion.minorVersion).\(osVersion.patchVersion)" + } +} +#else +// TODO: Implement for Linux & Windows +public struct PlatformOperationSystemVersion { + static public func operatingSystemVersion() -> String? { + return nil + } +} +#endif