Skip to content

Commit

Permalink
Performed migration to Swift 5
Browse files Browse the repository at this point in the history
  • Loading branch information
aure committed Mar 26, 2019
1 parent daff4e4 commit 186b7d2
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions AudioKit/Common/Internals/AVAudioEngine+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ extension AVAudioEngine {
case .error, .insufficientDataFromInputNode:
throw NSError(domain: "AVAudioEngine ext", code: 1,
userInfo: [NSLocalizedDescriptionKey: "renderToFile render error"])
@unknown default:
fatalError("Unknown render result")
}
}

Expand Down
2 changes: 2 additions & 0 deletions AudioKit/Common/Internals/Audio File/AKAudioFile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ extension AVAudioCommonFormat: CustomStringConvertible {
return "PCMFormatInt16"
case .pcmFormatInt32:
return "PCMFormatInt32"
@unknown default:
fatalError("Unknown Type")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion AudioKit/Common/Internals/AudioKit+SafeConnections.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ extension AudioKit {
nodes.enumerated().forEach { (id, node) in

let outputs: [(id: Int, node: AVAudioNode, bus: Int)] = node.connectionPoints.compactMap {
guard let node = $0.node, let id = nodes.index(of: node) else { return nil }
guard let node = $0.node, let id = nodes.firstIndex(of: node) else { return nil }
return (id, node, $0.bus)
}

Expand Down
2 changes: 2 additions & 0 deletions AudioKit/Common/Internals/AudioKit+Testing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ extension AudioKit {
case .error:
// error occurred while rendering
fatalError("render failed")
@unknown default:
fatalError("Unknown render result")
}
}
tester?.stop()
Expand Down
4 changes: 2 additions & 2 deletions AudioKit/Common/MIDI/AKMIDIEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public struct AKMIDIEvent {
// flag midi system that a sysex packet has started so it can gather bytes until the end
AudioKit.midi.startReceivingSysex(with: midiBytes)
internalData += midiBytes
if let sysexEndIndex = midiBytes.index(of: AKMIDISystemCommand.sysexEnd.byte) {
if let sysexEndIndex = midiBytes.firstIndex(of: AKMIDISystemCommand.sysexEnd.byte) {
let length = sysexEndIndex + 1
internalData = Array(internalData.prefix(length))
AudioKit.midi.stopReceivingSysex()
Expand Down Expand Up @@ -149,7 +149,7 @@ public struct AKMIDIEvent {
public init(data: [MIDIByte], time: MIDITimeStamp = 0) {
timeStamp = time
if AudioKit.midi.isReceivingSysex {
if let sysexEndIndex = data.index(of: AKMIDISystemCommand.sysexEnd.rawValue) {
if let sysexEndIndex = data.firstIndex(of: AKMIDISystemCommand.sysexEnd.rawValue) {
internalData = Array(data[0...sysexEndIndex])
}
} else if let command = AKMIDISystemCommand(rawValue: data[0]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ open class AKClipRecorder {
}

private func finalize(clip: AKClipRecording, error: Error? = nil, completion: (() -> Void)? = nil) {
if let index = clips.index(of: clip) {
if let index = clips.firstIndex(of: clip) {
clips.remove(at: index)
}

Expand Down
4 changes: 3 additions & 1 deletion AudioKit/iOS/AudioKit For iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5745,7 +5745,7 @@
TargetAttributes = {
C42F34FF1C057E03000E937C = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 1000;
LastSwiftMigration = 1020;
};
EA7D07001F4E63C200707706 = {
CreatedOnToolsVersion = 9.0;
Expand Down Expand Up @@ -6818,6 +6818,7 @@
SKIP_INSTALL = YES;
SWIFT_INCLUDE_PATHS = "";
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand Down Expand Up @@ -6848,6 +6849,7 @@
SKIP_INSTALL = YES;
SWIFT_INCLUDE_PATHS = "";
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down

0 comments on commit 186b7d2

Please sign in to comment.