Skip to content

Commit 563acf6

Browse files
committed
Use old guard-let syntax to gain Swift 5.6 compatability
1 parent 0d317cd commit 563acf6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Sources/SwiftWhisper/Whisper.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public class Whisper {
4545
// swiftlint:disable line_length
4646
params.new_segment_callback = { (ctx: OpaquePointer?, _: OpaquePointer?, newSegmentCount: Int32, userData: UnsafeMutableRawPointer?) in
4747
// swiftlint:enable line_length
48-
guard let ctx, let userData else { return }
48+
guard let ctx = ctx,
49+
let userData = userData else { return }
4950
let whisper = Unmanaged<Whisper>.fromOpaque(userData).takeUnretainedValue()
5051
guard let delegate = whisper.delegate else { return }
5152

@@ -73,7 +74,7 @@ public class Whisper {
7374
}
7475

7576
params.encoder_begin_callback = { (_: OpaquePointer?, _: OpaquePointer?, userData: UnsafeMutableRawPointer?) in
76-
guard let userData else { return true }
77+
guard let userData = userData else { return true }
7778
let whisper = Unmanaged<Whisper>.fromOpaque(userData).takeUnretainedValue()
7879

7980
if whisper.cancelCallback != nil {
@@ -86,7 +87,7 @@ public class Whisper {
8687
// swiftlint:disable line_length
8788
params.progress_callback = { (_: OpaquePointer?, _: OpaquePointer?, progress: Int32, userData: UnsafeMutableRawPointer?) in
8889
// swiftlint:enable line_length
89-
guard let userData else { return }
90+
guard let userData = userData else { return }
9091
let whisper = Unmanaged<Whisper>.fromOpaque(userData).takeUnretainedValue()
9192

9293
DispatchQueue.main.async {
@@ -96,7 +97,7 @@ public class Whisper {
9697
}
9798

9899
private func cleanupCallbacks() {
99-
guard let unmanagedSelf else { return }
100+
guard let unmanagedSelf = unmanagedSelf else { return }
100101

101102
unmanagedSelf.release()
102103
self.unmanagedSelf = nil

0 commit comments

Comments
 (0)