mirror of
https://github.com/yattee/yattee.git
synced 2025-08-05 02:04:07 +00:00
Use Swift 5.7 if-let style
This commit is contained in:
@@ -32,7 +32,7 @@ struct Buffering: View {
|
||||
|
||||
Text(reason)
|
||||
.font(.system(size: playerControlsLayout.timeFontSize))
|
||||
if let state = state {
|
||||
if let state {
|
||||
Text(state)
|
||||
.font(.system(size: playerControlsLayout.bufferingStateFontSize).monospacedDigit())
|
||||
}
|
||||
|
@@ -206,12 +206,12 @@ struct PlayerControls: View {
|
||||
}
|
||||
|
||||
var detailsWidth: Double {
|
||||
guard let player = player, player.playerSize.width.isFinite else { return 200 }
|
||||
guard let player, player.playerSize.width.isFinite else { return 200 }
|
||||
return [player.playerSize.width, 600].min()!
|
||||
}
|
||||
|
||||
var detailsHeight: Double {
|
||||
guard let player = player, player.playerSize.height.isFinite else { return 200 }
|
||||
guard let player, player.playerSize.height.isFinite else { return 200 }
|
||||
return [player.playerSize.height, 500].min()!
|
||||
}
|
||||
|
||||
|
@@ -36,7 +36,7 @@ final class MPVOGLView: GLKView {
|
||||
}
|
||||
|
||||
override func draw(_: CGRect) {
|
||||
guard needsDrawing, let mpvGL = mpvGL else {
|
||||
guard needsDrawing, let mpvGL else {
|
||||
return
|
||||
}
|
||||
|
||||
|
@@ -53,7 +53,7 @@ struct StreamControl: View {
|
||||
}
|
||||
.transaction { t in t.animation = .none }
|
||||
.onChange(of: player.streamSelection) { selection in
|
||||
guard let selection = selection else { return }
|
||||
guard let selection else { return }
|
||||
player.upgradeToStream(selection)
|
||||
player.controls.hideOverlays()
|
||||
}
|
||||
|
@@ -143,7 +143,7 @@ struct VideoDetails: View {
|
||||
|
||||
var publishedDateSection: some View {
|
||||
Group {
|
||||
if let video = video {
|
||||
if let video {
|
||||
HStack(spacing: 4) {
|
||||
if let published = video.publishedDate {
|
||||
Text(published)
|
||||
@@ -227,7 +227,7 @@ struct VideoDetails: View {
|
||||
|
||||
var detailsPage: some View {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
if let video = video {
|
||||
if let video {
|
||||
VStack(spacing: 6) {
|
||||
videoProperties
|
||||
|
||||
|
@@ -33,7 +33,7 @@ struct VideoPlayerSizeModifier: ViewModifier {
|
||||
}
|
||||
|
||||
var usedAspectRatio: Double {
|
||||
guard let aspectRatio = aspectRatio, aspectRatio > 0, aspectRatio < VideoPlayerView.defaultAspectRatio else {
|
||||
guard let aspectRatio, aspectRatio > 0, aspectRatio < VideoPlayerView.defaultAspectRatio else {
|
||||
return VideoPlayerView.defaultAspectRatio
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user