Skip to content

Commit

Permalink
lint の Swift Version を 5.10 にあげる
Browse files Browse the repository at this point in the history
  • Loading branch information
miosakuma committed Apr 17, 2024
1 parent fe81f82 commit 3d01517
Show file tree
Hide file tree
Showing 18 changed files with 125 additions and 130 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.8
5.10
4 changes: 2 additions & 2 deletions Sora/AspectRatio.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public enum AspectRatio {
public func height(forWidth width: CGFloat) -> CGFloat {
switch self {
case .standard:
return width / 4 * 3
width / 4 * 3
case .wide:
return width / 16 * 9
width / 16 * 9
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sora/AudioMode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public enum AudioOutput {
var portOverride: AVAudioSession.PortOverride {
switch self {
case .default:
return .none
.none
case .speaker:
return .speaker
.speaker
}
}
}
52 changes: 24 additions & 28 deletions Sora/CameraVideoCapturer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,18 @@ public final class CameraVideoCapturer {
public static var devices: [AVCaptureDevice] { RTCCameraVideoCapturer.captureDevices() }

/// 前面のカメラに対応するデバイス
public private(set) static var front: CameraVideoCapturer? = {
if let device = device(for: .front) {
return CameraVideoCapturer(device: device)
} else {
return nil
}
}()
public private(set) static var front: CameraVideoCapturer? = if let device = device(for: .front) {
CameraVideoCapturer(device: device)
} else {
nil
}

/// 背面のカメラに対応するデバイス
public private(set) static var back: CameraVideoCapturer? = {
if let device = device(for: .back) {
return CameraVideoCapturer(device: device)
} else {
return nil
}
}()
public private(set) static var back: CameraVideoCapturer? = if let device = device(for: .back) {
CameraVideoCapturer(device: device)
} else {
nil
}

/// 起動中のデバイス
public private(set) static var current: CameraVideoCapturer?
Expand Down Expand Up @@ -359,26 +355,26 @@ public struct CameraSettings: CustomStringConvertible {
/// 横方向のピクセル数を返します。
public var width: Int32 {
switch self {
case .qvga240p: return 320
case .vga480p: return 640
case .qhd540p: return 960
case .hd720p: return 1280
case .hd1080p: return 1920
case .uhd2160p: return 3840
case .uhd3024p: return 4032
case .qvga240p: 320
case .vga480p: 640
case .qhd540p: 960
case .hd720p: 1280
case .hd1080p: 1920
case .uhd2160p: 3840
case .uhd3024p: 4032
}
}

/// 縦方向のピクセル数を返します。
public var height: Int32 {
switch self {
case .qvga240p: return 240
case .vga480p: return 480
case .qhd540p: return 540
case .hd720p: return 720
case .hd1080p: return 1080
case .uhd2160p: return 2160
case .uhd3024p: return 3024
case .qvga240p: 240
case .vga480p: 480
case .qhd540p: 540
case .hd720p: 720
case .hd1080p: 1080
case .uhd2160p: 2160
case .uhd3024p: 3024
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Sora/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,17 @@ public struct Configuration {
var isMultistream: Bool {
switch role {
default:
return multistreamEnabled
multistreamEnabled
}
}

/// :nodoc:
var isSender: Bool {
switch role {
case .sendonly, .sendrecv:
return true
true
default:
return false
false
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sora/ConnectionState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public enum ConnectionState {
var isDisconnected: Bool {
switch self {
case .disconnecting, .disconnected:
return true
true
default:
return false
false
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sora/ConnectionTimer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ enum ConnectionMonitor {
var state: ConnectionState {
switch self {
case let .signalingChannel(chan):
return chan.state
chan.state
case let .peerChannel(chan):
return ConnectionState(chan.state)
ConnectionState(chan.state)
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sora/ICETransportPolicy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ extension ICETransportPolicy: CustomStringConvertible {
public var description: String {
switch self {
case .relay:
return "relay"
"relay"
case .all:
return "all"
"all"
}
}
}
Expand Down
58 changes: 29 additions & 29 deletions Sora/Logger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,35 @@ extension LogType: CustomStringConvertible {
public var description: String {
switch self {
case .sora:
return "Sora"
"Sora"
case .webSocketChannel:
return "WebSocketChannel"
"WebSocketChannel"
case .signaling:
return "Signaling"
"Signaling"
case .signalingChannel:
return "SignalingChannel"
"SignalingChannel"
case .peerChannel:
return "PeerChannel"
"PeerChannel"
case .nativePeerChannel:
return "NativePeerChannel"
"NativePeerChannel"
case .connectionTimer:
return "ConnectionTimer"
"ConnectionTimer"
case .mediaChannel:
return "MediaChannel"
"MediaChannel"
case .mediaStream:
return "MediaStream"
"MediaStream"
case .cameraVideoCapturer:
return "CameraVideoCapturer"
"CameraVideoCapturer"
case .videoRenderer:
return "VideoRenderer"
"VideoRenderer"
case .videoView:
return "VideoView"
"VideoView"
case let .user(name):
return name
name
case .configurationViewController:
return "ConfigurationViewController"
"ConfigurationViewController"
case .dataChannel:
return "DataChannel"
"DataChannel"
}
}
}
Expand Down Expand Up @@ -101,19 +101,19 @@ extension LogLevel {
var value: Int {
switch self {
case .fatal:
return 6
6
case .error:
return 5
5
case .warn:
return 4
4
case .info:
return 3
3
case .debug:
return 2
2
case .trace:
return 1
1
case .off:
return 0
0
}
}
}
Expand All @@ -123,19 +123,19 @@ extension LogLevel: CustomStringConvertible {
public var description: String {
switch self {
case .fatal:
return "FATAL"
"FATAL"
case .error:
return "ERROR"
"ERROR"
case .warn:
return "WARN"
"WARN"
case .info:
return "INFO"
"INFO"
case .debug:
return "DEBUG"
"DEBUG"
case .trace:
return "TRACE"
"TRACE"
case .off:
return "OFF"
"OFF"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sora/MediaChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ public final class MediaChannel {
/// 接続中にのみ取得可能です。
public var connectionTime: Int? {
if let start = connectionStartTime {
return Int(Date().timeIntervalSince(start))
Int(Date().timeIntervalSince(start))
} else {
return nil
nil
}
}

Expand Down
22 changes: 11 additions & 11 deletions Sora/NativePeerChannelFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ class NativePeerChannelFactory {
delegate: RTCPeerConnectionDelegate?) -> RTCPeerConnection?
{
if let proxy {
return nativeFactory.peerConnection(with: configuration.nativeValue,
constraints: constraints.nativeValue,
certificateVerifier: nil,
delegate: delegate,
proxyType: RTCProxyType.https,
proxyAgent: proxy.agent,
proxyHostname: proxy.host,
proxyPort: Int32(proxy.port),
proxyUsername: proxy.username ?? "",
proxyPassword: proxy.password ?? "")
nativeFactory.peerConnection(with: configuration.nativeValue,
constraints: constraints.nativeValue,
certificateVerifier: nil,
delegate: delegate,
proxyType: RTCProxyType.https,
proxyAgent: proxy.agent,
proxyHostname: proxy.host,
proxyPort: Int32(proxy.port),
proxyUsername: proxy.username ?? "",
proxyPassword: proxy.password ?? "")
} else {
return nativeFactory.peerConnection(with: configuration.nativeValue, constraints: constraints.nativeValue, delegate: delegate)
nativeFactory.peerConnection(with: configuration.nativeValue, constraints: constraints.nativeValue, delegate: delegate)
}
}

Expand Down
28 changes: 14 additions & 14 deletions Sora/Signaling.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,33 +148,33 @@ public enum Signaling {
public func typeName() -> String {
switch self {
case .connect:
return "connect"
"connect"
case .offer:
return "offer"
"offer"
case .answer:
return "answer"
"answer"
case .update:
return "update"
"update"
case .reOffer:
return "re-offer"
"re-offer"
case .reAnswer:
return "re-answer"
"re-answer"
case .candidate:
return "candidate"
"candidate"
case .notify:
return "notify"
"notify"
case .ping:
return "ping"
"ping"
case .pong:
return "pong"
"pong"
case .disconnect:
return "disconnect"
"disconnect"
case .push:
return "push"
"push"
case .switched:
return "switched"
"switched"
case .redirect:
return "redirect"
"redirect"
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Sora/SoraDispatcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ public enum SoraDispatcher {

/// 指定されたキューを利用して、 block を非同期で実行します。
public static func async(on queue: SoraDispatcher, block: @escaping () -> Void) {
let native: RTCDispatcherQueueType
let native: RTCDispatcherQueueType =
switch queue {
case .camera:
native = .typeCaptureSession
.typeCaptureSession
case .audio:
native = .typeAudioSession
.typeAudioSession
}
RTCDispatcher.dispatchAsync(on: native, block: block)
}
Expand Down
4 changes: 2 additions & 2 deletions Sora/Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ public extension Optional {
func unwrap(ifNone: () throws -> Wrapped) rethrows -> Wrapped {
switch self {
case let .some(value):
return value
value
case .none:
return try ifNone()
try ifNone()
}
}
}
Loading

0 comments on commit 3d01517

Please sign in to comment.