Skip to content

Commit d23a558

Browse files
authored
chore: os version in useragent for foundation based OS (#394)
1 parent 6d07a94 commit d23a558

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//
2+
// Copyright Amazon.com Inc. or its affiliates.
3+
// All Rights Reserved.
4+
//
5+
// SPDX-License-Identifier: Apache-2.0
6+
//
7+
8+
#if os(iOS) || os (watchOS) || os(macOS) || os(tvOS)
9+
import Foundation.NSProcessInfo
10+
11+
public struct PlatformOperationSystemVersion {
12+
static public func operatingSystemVersion() -> String? {
13+
let osVersion = ProcessInfo.processInfo.operatingSystemVersion
14+
return "\(osVersion.majorVersion).\(osVersion.minorVersion).\(osVersion.patchVersion)"
15+
}
16+
}
17+
#else
18+
// TODO: Implement for Linux & Windows
19+
public struct PlatformOperationSystemVersion {
20+
static public func operatingSystemVersion() -> String? {
21+
return nil
22+
}
23+
}
24+
#endif

0 commit comments

Comments
 (0)