Modern Apps git

xtool.git

Public
git clone https://git.maproj.org/xtool.git
main ▾

xtool.git / Sources / XKit / Signer / SigningContext.swift

SigningContext.swift51 lines · 1.1 KiBRaw
1//
2// SigningContext.swift
3// XKit
4//
5// Created by Kabir Oberai on 13/10/19.
6// Copyright © 2019 Kabir Oberai. All rights reserved.
7//
8
9import Foundation
10import DeveloperAPI
11
12public struct SigningContext: Sendable {
13
14 public struct TargetDevice: Sendable, Hashable {
15 public var udid: String
16 public var name: String
17 }
18
19 public var auth: DeveloperAPIAuthData
20 public var targetDevice: TargetDevice?
21
22 public var developerAPIClient: DeveloperAPIClient {
23 DeveloperAPIClient(auth: auth)
24 }
25
26 public init(
27 auth: DeveloperAPIAuthData,
28 targetDevice: TargetDevice? = nil
29 ) {
30 self.auth = auth
31 self.targetDevice = targetDevice
32 }
33
34}
35
36#if canImport(UIKit)
37import UIKit
38#endif
39extension SigningContext {
40 @MainActor public static var hostName: String {
41 #if targetEnvironment(simulator)
42 return "Simulator"
43 #elseif canImport(UIKit)
44 return UIDevice.current.name
45 #elseif os(macOS)
46 return Host.current().localizedName ?? "Mac"
47 #else
48 return "XTool Client"
49 #endif
50 }
51}