Skip to content

Commit b03d7c2

Browse files
committed
format swift
1 parent 6f2ff5f commit b03d7c2

14 files changed

+185
-181
lines changed

shared_swift/.swift-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5.9

shared_swift/.swiftformat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--exclude Sources/LiveKit/Protos
2+
--header "/*\n * Copyright {year} LiveKit\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */"
3+
--ifdef no-indent
4+
--disable modifiersOnSameLine

shared_swift/AVAudioPCMBuffer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 LiveKit
2+
* Copyright 2025 LiveKit
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

shared_swift/AudioConverter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 LiveKit
2+
* Copyright 2025 LiveKit
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

shared_swift/AudioProcessing.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 LiveKit
2+
* Copyright 2025 LiveKit
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,10 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17-
import WebRTC
1817
import Accelerate
1918
import AVFoundation
2019
import Foundation
20+
import WebRTC
2121

2222
public struct AudioLevel {
2323
/// Linear Scale RMS Value

shared_swift/AudioRenderer.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 LiveKit
2+
* Copyright 2025 LiveKit
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,11 +18,11 @@ import AVFoundation
1818
import WebRTC
1919

2020
#if os(macOS)
21-
import Cocoa
22-
import FlutterMacOS
21+
import Cocoa
22+
import FlutterMacOS
2323
#else
24-
import Flutter
25-
import UIKit
24+
import Flutter
25+
import UIKit
2626
#endif
2727

2828
public class AudioRenderer: NSObject {
@@ -97,7 +97,7 @@ public extension AVAudioPCMBuffer {
9797
]
9898

9999
// Extract audio data based on the buffer format
100-
if let floatChannelData = floatChannelData {
100+
if let floatChannelData {
101101
// Buffer contains float data
102102
var channelsData: [[Float]] = []
103103

@@ -109,7 +109,7 @@ public extension AVAudioPCMBuffer {
109109

110110
result["data"] = channelsData
111111
result["commonFormat"] = "float32"
112-
} else if let int16ChannelData = int16ChannelData {
112+
} else if let int16ChannelData {
113113
// Buffer contains int16 data
114114
var channelsData: [[Int16]] = []
115115

@@ -121,7 +121,7 @@ public extension AVAudioPCMBuffer {
121121

122122
result["data"] = channelsData
123123
result["commonFormat"] = "int16"
124-
} else if let int32ChannelData = int32ChannelData {
124+
} else if let int32ChannelData {
125125
// Buffer contains int32 data
126126
var channelsData: [[Int32]] = []
127127

@@ -145,7 +145,7 @@ public extension AVAudioPCMBuffer {
145145

146146
extension AudioRenderer: RTCAudioRenderer {
147147
public func render(pcmBuffer: AVAudioPCMBuffer) {
148-
guard let eventSink = eventSink else { return }
148+
guard let eventSink else { return }
149149

150150
// Create or update converter if needed
151151
if converter == nil || pcmBuffer.format != converter!.inputFormat || format != converter!.outputFormat {

shared_swift/AudioTrack.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 LiveKit
2+
* Copyright 2025 LiveKit
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@ import WebRTC
1919

2020
@objc
2121
public protocol AudioTrack where Self: Track {
22-
2322
@objc(addAudioRenderer:)
2423
func add(audioRenderer: RTCAudioRenderer)
2524

shared_swift/FFTProcessor.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 LiveKit
2+
* Copyright 2025 LiveKit
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -72,14 +72,14 @@ public class FFTResult {
7272
}
7373

7474
class FFTProcessor {
75-
public enum WindowType {
75+
enum WindowType {
7676
case none
7777
case hanning
7878
case hamming
7979
}
8080

81-
public let bufferSize: vDSP_Length
82-
public let windowType: WindowType
81+
let bufferSize: vDSP_Length
82+
let windowType: WindowType
8383

8484
private let bufferHalfSize: vDSP_Length
8585
private let bufferLog2Size: vDSP_Length

0 commit comments

Comments
 (0)