Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint で利用する Swift のバージョンを 5.8 -> 5.10 にあげる #209

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 Podfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ platform :ios, '13.0'
target 'Sora' do
use_frameworks!
pod 'WebRTC', '127.6533.1.1'
pod 'SwiftLint', '0.51.0'
pod 'SwiftFormat/CLI', '0.53.2'
pod 'SwiftLint', '0.56.1'
pod 'SwiftFormat/CLI', '0.54.3'
end
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
1 change: 0 additions & 1 deletion Sora/DataChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ class BasicDataChannelDelegate: NSObject, RTCDataChannelDelegate {
}
}
}

case "signaling", "push", "notify":
switch Signaling.decode(data) {
case let .success(signaling):
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
1 change: 0 additions & 1 deletion Sora/PeerChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,6 @@ class PeerChannel: NSObject, RTCPeerConnectionDelegate {
}
case let .reOffer(reOffer):
createAndSendReAnswer(forReOffer: reOffer.sdp)

case let .ping(ping):
let pong = SignalingPong()
if ping.statisticsEnabled == true {
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
7 changes: 3 additions & 4 deletions Sora/SoraDispatcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ public enum SoraDispatcher {

/// 指定されたキューを利用して、 block を非同期で実行します。
public static func async(on queue: SoraDispatcher, block: @escaping () -> Void) {
let native: RTCDispatcherQueueType
switch queue {
let native: RTCDispatcherQueueType = switch queue {
case .camera:
native = .typeCaptureSession
.typeCaptureSession
case .audio:
native = .typeAudioSession
.typeAudioSession
}
RTCDispatcher.dispatchAsync(on: native, block: block)
}
Expand Down
Loading
Loading