Repository navigation
Expand file tree
/
Copy pathHostViewConfig.swift
More file actions
91 lines (83 loc) · 2.99 KB
/
Copy pathHostViewConfig.swift
File metadata and controls
91 lines (83 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// Copyright © 2022-2024 Brad Howes. All rights reserved.
#if os(iOS)
import CoreAudioKit
import AUv3Support
/**
The configuration to use for the iOS `HostViewController`.
*/
public struct HostViewConfig {
public let name: String
public let appDelegate: AppDelegate
public let appStoreId: String
public let componentDescription: AudioComponentDescription
public let sampleLoop: SampleLoop
public let tintColor: UIColor
public let appStoreVisitor: (URL) -> Void
public let alwaysShowNotice: Bool
public let defaults: UserDefaults
/**
The configuration parameters.
- parameter name: the name of the audio unit to host
- parameter version: the version of the audio unit being hosted
- parameter appStoreId: the app store ID for the audio unit
- parameter componentDescription: the description of the audio unit used to find it on the device
- parameter sampleLoop: the sample loop to play
- parameter tintColor: color to use for control tinting
- parameter appStoreVisitor: the closure to invoke to visit the app store and view the page for the audio unit
*/
@available(*, deprecated, message: "Version is no longer needed")
public init(
name: String,
version: String,
appDelegate: AppDelegate,
appStoreId: String,
componentDescription: AudioComponentDescription,
sampleLoop: SampleLoop,
tintColor: UIColor,
appStoreVisitor: @escaping (URL) -> Void,
alwaysShowNotice: Bool = false,
defaults: UserDefaults = .standard
) {
self.name = name
self.appDelegate = appDelegate
self.appStoreId = appStoreId
self.componentDescription = componentDescription
self.sampleLoop = sampleLoop
self.tintColor = tintColor
self.appStoreVisitor = appStoreVisitor
self.alwaysShowNotice = alwaysShowNotice
self.defaults = defaults
}
/**
The configuration parameters.
- parameter name: the name of the audio unit to host
- parameter version: the version of the audio unit being hosted
- parameter appStoreId: the app store ID for the audio unit
- parameter componentDescription: the description of the audio unit used to find it on the device
- parameter sampleLoop: the sample loop to play
- parameter tintColor: color to use for control tinting
- parameter appStoreVisitor: the closure to invoke to visit the app store and view the page for the audio unit
*/
public init(
name: String,
appDelegate: AppDelegate,
appStoreId: String,
componentDescription: AudioComponentDescription,
sampleLoop: SampleLoop,
tintColor: UIColor,
appStoreVisitor: @escaping (URL) -> Void,
alwaysShowNotice: Bool = false,
defaults: UserDefaults = .standard
) {
self.name = name
self.appDelegate = appDelegate
self.appStoreId = appStoreId
self.componentDescription = componentDescription
self.sampleLoop = sampleLoop
self.tintColor = tintColor
self.appStoreVisitor = appStoreVisitor
self.alwaysShowNotice = alwaysShowNotice
self.defaults = defaults
}
}
#endif