Skip to content

Commit dbd1b85

Browse files
committed
Revert "Merge branch 'swift6' into main"
This reverts commit 26027f8, reversing changes made to a1435b4.
1 parent 26027f8 commit dbd1b85

File tree

73 files changed

+835
-767
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+835
-767
lines changed

Examples/Advanced/HUITest/HUITest.xcodeproj/project.pbxproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
E284EBD226AE01F00016AA0F /* HUISurfaceView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E284EBCF26AE01F00016AA0F /* HUISurfaceView.swift */; };
4343
E284EBD326AE01F00016AA0F /* MixerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E284EBD026AE01F00016AA0F /* MixerView.swift */; };
4444
E284EBD426AE01F00016AA0F /* TopView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E284EBD126AE01F00016AA0F /* TopView.swift */; };
45+
E284EBD826AE02090016AA0F /* HUISwitch Wrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = E284EBD726AE02090016AA0F /* HUISwitch Wrapper.swift */; };
4546
E2D5FB1B28D9198A0040A023 /* HUIHostView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2D5FB1A28D9198A0040A023 /* HUIHostView.swift */; };
4647
/* End PBXBuildFile section */
4748

@@ -79,6 +80,7 @@
7980
E284EBCF26AE01F00016AA0F /* HUISurfaceView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HUISurfaceView.swift; sourceTree = "<group>"; };
8081
E284EBD026AE01F00016AA0F /* MixerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MixerView.swift; sourceTree = "<group>"; };
8182
E284EBD126AE01F00016AA0F /* TopView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TopView.swift; sourceTree = "<group>"; };
83+
E284EBD726AE02090016AA0F /* HUISwitch Wrapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "HUISwitch Wrapper.swift"; sourceTree = "<group>"; };
8284
E2D5FB1A28D9198A0040A023 /* HUIHostView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUIHostView.swift; sourceTree = "<group>"; };
8385
/* End PBXFileReference section */
8486

@@ -173,6 +175,7 @@
173175
E284EBCE26AE01F00016AA0F /* HUISurfaceView */,
174176
E284EBCA26AE01EA0016AA0F /* Control Views */,
175177
E284EBB526AE018F0016AA0F /* HUITestApp.swift */,
178+
E284EBD726AE02090016AA0F /* HUISwitch Wrapper.swift */,
176179
E232239E2914F596005F0C12 /* Utilities.swift */,
177180
E21628E326E2DFF30022B66F /* Logger.swift */,
178181
E284EBC126AE01900016AA0F /* Info.plist */,
@@ -292,6 +295,7 @@
292295
files = (
293296
E283F0A3274101FD0037F199 /* LargeTextDisplayView.swift in Sources */,
294297
E284EBCC26AE01EA0016AA0F /* Buttons.swift in Sources */,
298+
E284EBD826AE02090016AA0F /* HUISwitch Wrapper.swift in Sources */,
295299
E2D5FB1B28D9198A0040A023 /* HUIHostView.swift in Sources */,
296300
E232239F2914F596005F0C12 /* Utilities.swift in Sources */,
297301
E283F0B5274103E00037F199 /* TransportView.swift in Sources */,
@@ -380,7 +384,7 @@
380384
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
381385
GCC_WARN_UNUSED_FUNCTION = YES;
382386
GCC_WARN_UNUSED_VARIABLE = YES;
383-
MACOSX_DEPLOYMENT_TARGET = 14.0;
387+
MACOSX_DEPLOYMENT_TARGET = 13.0;
384388
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
385389
MTL_FAST_MATH = YES;
386390
ONLY_ACTIVE_ARCH = YES;
@@ -438,7 +442,7 @@
438442
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
439443
GCC_WARN_UNUSED_FUNCTION = YES;
440444
GCC_WARN_UNUSED_VARIABLE = YES;
441-
MACOSX_DEPLOYMENT_TARGET = 14.0;
445+
MACOSX_DEPLOYMENT_TARGET = 13.0;
442446
MTL_ENABLE_DEBUG_INFO = NO;
443447
MTL_FAST_MATH = YES;
444448
SDKROOT = macosx;

Examples/Advanced/HUITest/HUITest.xcodeproj/xcshareddata/xcschemes/HUITest.xcscheme

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
3737
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
3838
enableASanStackUseAfterReturn = "YES"
39-
enableThreadSanitizer = "YES"
4039
launchStyle = "0"
4140
useCustomWorkingDirectory = "NO"
4241
ignoresPersistentStateOnLaunch = "NO"

Examples/Advanced/HUITest/HUITest/Control Views/Buttons.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ struct MomentaryButton: View, MomentaryButtonProtocol {
9191
}
9292

9393
struct HUIButton: View, MomentaryButtonProtocol {
94-
@Environment(HUISurface.self) var huiSurface
94+
@EnvironmentObject var huiSurface: HUISurface
9595

9696
let image: Image?
9797
let title: String
9898
var fontSize: CGFloat?
9999
var width: CGFloat?
100100
var height: CGFloat?
101-
private let huiSwitch: HUISwitch
101+
private let huiSwitch: HUISwitch.Wrapper
102102

103103
init(
104104
image: Image? = nil,
@@ -110,7 +110,7 @@ struct HUIButton: View, MomentaryButtonProtocol {
110110
) {
111111
self.image = image
112112
self.title = title
113-
huiSwitch = param
113+
huiSwitch = .init(param)
114114
self.width = width
115115
self.height = height
116116
self.fontSize = fontSize
@@ -124,23 +124,23 @@ struct HUIButton: View, MomentaryButtonProtocol {
124124
width: width,
125125
height: height
126126
) {
127-
huiSurface.transmitSwitch(huiSwitch, state: true)
127+
huiSurface.transmitSwitch(huiSwitch.wrapped, state: true)
128128
} releasedAction: {
129-
huiSurface.transmitSwitch(huiSwitch, state: false)
129+
huiSurface.transmitSwitch(huiSwitch.wrapped, state: false)
130130
}
131131
.foregroundColor(.black)
132132
}
133133
}
134134

135135
struct HUIStateButton: View, MomentaryButtonProtocol {
136-
@Environment(HUISurface.self) var huiSurface
136+
@EnvironmentObject var huiSurface: HUISurface
137137

138138
let image: Image?
139139
let title: String
140140
var fontSize: CGFloat?
141141
var width: CGFloat?
142142
var height: CGFloat?
143-
private let huiSwitch: HUISwitch
143+
private let huiSwitch: HUISwitch.Wrapper
144144
let ledColor: Color
145145

146146
init(
@@ -157,21 +157,21 @@ struct HUIStateButton: View, MomentaryButtonProtocol {
157157
self.fontSize = fontSize
158158
self.width = width
159159
self.height = height
160-
huiSwitch = param
160+
huiSwitch = .init(param)
161161
self.ledColor = ledColor.color
162162
}
163163

164164
var body: some View {
165165
HUIButton(
166166
image: image,
167167
title: title,
168-
param: huiSwitch,
168+
param: huiSwitch.wrapped,
169169
width: width,
170170
height: height,
171171
fontSize: fontSize
172172
)
173173
.colorMultiply(
174-
huiSurface.model.state(of: huiSwitch)
174+
huiSurface.model.state(of: huiSwitch.wrapped)
175175
? ledColor
176176
: Color(white: 1, opacity: 1)
177177
)
@@ -195,7 +195,7 @@ extension HUIStateButton {
195195
}
196196

197197
struct HUINumPadButton: View, MomentaryButtonProtocol {
198-
@Environment(HUISurface.self) var huiSurface
198+
@EnvironmentObject var huiSurface: HUISurface
199199

200200
static let kDefaultSize: CGFloat = 40
201201

@@ -206,7 +206,7 @@ struct HUINumPadButton: View, MomentaryButtonProtocol {
206206
var spacing: CGFloat?
207207
let widthScale: CGFloat
208208
let heightScale: CGFloat
209-
private let huiSwitch: HUISwitch
209+
private let huiSwitch: HUISwitch.Wrapper
210210

211211
init(
212212
image: Image? = nil,
@@ -220,7 +220,7 @@ struct HUINumPadButton: View, MomentaryButtonProtocol {
220220
) {
221221
self.image = image
222222
self.title = title
223-
huiSwitch = param
223+
huiSwitch = .init(param)
224224
self.width = width
225225
self.spacing = spacing
226226
self.widthScale = widthScale
@@ -236,9 +236,9 @@ struct HUINumPadButton: View, MomentaryButtonProtocol {
236236
width: calculateWidth(),
237237
height: calculateHeight()
238238
) {
239-
huiSurface.transmitSwitch(huiSwitch, state: true)
239+
huiSurface.transmitSwitch(huiSwitch.wrapped, state: true)
240240
} releasedAction: {
241-
huiSurface.transmitSwitch(huiSwitch, state: false)
241+
huiSurface.transmitSwitch(huiSwitch.wrapped, state: false)
242242
}
243243
.foregroundColor(.black)
244244
.cornerRadius(5)

Examples/Advanced/HUITest/HUITest/Control Views/Knobs.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import MIDIKitControlSurfaces
99
import SwiftUI
1010

1111
struct RotaryKnob: View {
12-
@Environment(HUISurface.self) var huiSurface
12+
@EnvironmentObject var huiSurface: HUISurface
1313

1414
var label: String
1515
var size: CGFloat
@@ -80,7 +80,7 @@ struct RotaryKnob: View {
8080
KnobShape(size: size)
8181
}
8282
}
83-
.onChange(of: huiSurface.model.state(of: vPot)) { oldValue, newValue in
83+
.onChange(of: huiSurface.model.state(of: vPot)) { newValue in
8484
updateDisplay(newValue)
8585
}
8686
.highPriorityGesture(
@@ -196,7 +196,7 @@ struct KnobShape: View {
196196
}
197197

198198
struct JogWheel: View {
199-
@Environment(HUISurface.self) var huiSurface
199+
@EnvironmentObject var huiSurface: HUISurface
200200

201201
var size: CGFloat
202202

Examples/Advanced/HUITest/HUITest/Control Views/LiveFormattedTextField.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct LiveFormattedTextField: View {
2727

2828
var body: some View {
2929
TextField(titleKey, text: $liveText)
30-
.onChange(of: liveText) { oldValue, newValue in
30+
.onChange(of: liveText) { newValue in
3131
let formatted = formatter.string(for: newValue) ?? ""
3232
liveText = formatted
3333
value = formatted

Examples/Advanced/HUITest/HUITest/HUIHostView/HUIHostHelper.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,19 @@ import MIDIKitInternals // only for utils
1010
import MIDIKitIO
1111
import SwiftUI
1212

13-
@Observable final class HUIHostHelper {
13+
class HUIHostHelper: ObservableObject {
1414
// MARK: MIDI
15-
@ObservationIgnored
16-
@EnvironmentObject
17-
var midiManager: ObservableMIDIManager
15+
@EnvironmentObject var midiManager: ObservableMIDIManager
1816

1917
static let kHUIInputConnectionTag = "HUIHostInputConnection"
2018
static let kHUIOutputConnectionTag = "HUIHostOutputConnection"
2119

22-
var logPing: Bool = true
20+
@Published var logPing: Bool = true
2321

2422
var huiHost: HUIHost
25-
var isRemotePresent: Bool = false
23+
@Published var isRemotePresent: Bool = false
2624

27-
var model: HUIHostModel = .init()
25+
@Published var model: HUIHostModel = .init()
2826

2927
init(midiManager: ObservableMIDIManager) {
3028
huiHost = HUIHost()

Examples/Advanced/HUITest/HUITest/HUIHostView/HUIHostView.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ import SwiftUI
1111

1212
struct HUIHostView: View {
1313
@EnvironmentObject var midiManager: ObservableMIDIManager
14-
@State var huiHostHelper: HUIHostHelper
14+
@StateObject var huiHostHelper: HUIHostHelper
1515

1616
/// Convenience accessor for first HUI bank.
1717
private var huiBank0: HUIHostBank? { huiHostHelper.huiHost.banks.first }
1818

1919
init(midiManager: ObservableMIDIManager) {
2020
// set up HUI Host object
21-
_huiHostHelper = State(wrappedValue: HUIHostHelper(midiManager: midiManager))
21+
_huiHostHelper = StateObject(wrappedValue: HUIHostHelper(midiManager: midiManager))
2222
}
2323

2424
@State private var vPotDisplayFormat: VPotDisplayFormat = .single
@@ -60,12 +60,12 @@ struct HUIHostView: View {
6060
huiBank0?.transmitLevelMeter(
6161
channel: 0,
6262
side: .left,
63-
level: HUISurfaceModelState.StereoLevelMeter.levelRange.randomElement()!
63+
level: HUISurfaceModel.StereoLevelMeter.levelRange.randomElement()!
6464
)
6565
huiBank0?.transmitLevelMeter(
6666
channel: 0,
6767
side: .right,
68-
level: HUISurfaceModelState.StereoLevelMeter.levelRange.randomElement()!
68+
level: HUISurfaceModel.StereoLevelMeter.levelRange.randomElement()!
6969
)
7070
}
7171
GroupBox(label: Text("V-Pot")) {
@@ -77,7 +77,7 @@ struct HUIHostView: View {
7777
Text("Center Radius (Width)").tag(VPotDisplayFormat.centerRadius)
7878
}
7979
.pickerStyle(.menu)
80-
.onChange(of: vPotDisplayFormat) { _, _ in
80+
.onChange(of: vPotDisplayFormat) { _ in
8181
transmitVPot()
8282
}
8383
HStack {
@@ -89,24 +89,24 @@ struct HUIHostView: View {
8989
.frame(height: 20)
9090
.onChange(
9191
of: huiHostHelper.model.bank0.channel0.pan
92-
) { oldValue, newValue in
92+
) { newValue in
9393
transmitVPot(value: newValue)
9494
}
9595
}
9696
Toggle("Low", isOn: $huiHostHelper.model.bank0.channel0.vPotLowerLED)
9797
.onChange(
9898
of: huiHostHelper.model.bank0.channel0.vPotLowerLED
99-
) { oldValue, newValue in
99+
) { newValue in
100100
transmitVPot(lowerLED: newValue)
101101
}
102102
}
103103
}
104104
Toggle("Solo", isOn: $huiHostHelper.model.bank0.channel0.solo)
105-
.onChange(of: huiHostHelper.model.bank0.channel0.solo) { oldValue, newValue in
105+
.onChange(of: huiHostHelper.model.bank0.channel0.solo) { newValue in
106106
huiBank0?.transmitSwitch(.channelStrip(0, .solo), state: newValue)
107107
}
108108
Toggle("Mute", isOn: $huiHostHelper.model.bank0.channel0.mute)
109-
.onChange(of: huiHostHelper.model.bank0.channel0.mute) { oldValue, newValue in
109+
.onChange(of: huiHostHelper.model.bank0.channel0.mute) { newValue in
110110
huiBank0?.transmitSwitch(.channelStrip(0, .mute), state: newValue)
111111
}
112112
GroupBox(label: Text("4-Character LCD")) {
@@ -115,15 +115,15 @@ struct HUIHostView: View {
115115
formatter: MaxLengthFormatter(maxCharLength: 4)
116116
)
117117
.frame(width: 100)
118-
.onChange(of: huiHostHelper.model.bank0.channel0.name) { oldValue, newValue in
118+
.onChange(of: huiHostHelper.model.bank0.channel0.name) { newValue in
119119
huiBank0?.transmitSmallDisplay(
120120
.channel(0),
121121
text: .init(lossy: newValue)
122122
)
123123
}
124124
}
125125
Toggle("Selected", isOn: $huiHostHelper.model.bank0.channel0.selected)
126-
.onChange(of: huiHostHelper.model.bank0.channel0.selected) { oldValue, newValue in
126+
.onChange(of: huiHostHelper.model.bank0.channel0.selected) { newValue in
127127
huiBank0?.transmitSwitch(.channelStrip(0, .select), state: newValue)
128128
}
129129
GroupBox(label: Text("Fader")) {
@@ -138,7 +138,7 @@ struct HUIHostView: View {
138138
.frame(height: 20)
139139
.onChange(
140140
of: huiHostHelper.model.bank0.channel0.faderLevel
141-
) { oldValue, newValue in
141+
) { newValue in
142142
let scaledLevel = UInt14(newValue * Float(UInt14.max))
143143
huiBank0?.transmitFader(level: scaledLevel, channel: 0)
144144
}

0 commit comments

Comments
 (0)