Swift format

This commit is contained in:
Thomas Ricouard 2023-01-30 07:27:06 +01:00
parent 5871d13eee
commit 16636b12a9
26 changed files with 191 additions and 187 deletions

View file

@ -116,7 +116,8 @@ struct IceCubesApp: App {
} }
} }
if proxy.frame(in: .global).width > (.maxColumnWidth + .secondaryColumnWidth), if proxy.frame(in: .global).width > (.maxColumnWidth + .secondaryColumnWidth),
currentAccount.account?.id != nil { currentAccount.account?.id != nil
{
Divider().edgesIgnoringSafeArea(.all) Divider().edgesIgnoringSafeArea(.all)
NotificationsTab(popToRootTab: $popToRootTab, lockedType: nil) NotificationsTab(popToRootTab: $popToRootTab, lockedType: nil)
.environment(\.isSecondaryColumn, true) .environment(\.isSecondaryColumn, true)

View file

@ -12,7 +12,7 @@ struct QuickLookPreview: UIViewControllerRepresentable {
let selectedURL: URL let selectedURL: URL
let urls: [URL] let urls: [URL]
func makeUIViewController(context: Context) -> UIViewController { func makeUIViewController(context _: Context) -> UIViewController {
return AppQLPreviewController(selectedURL: selectedURL, urls: urls) return AppQLPreviewController(selectedURL: selectedURL, urls: urls)
} }
@ -33,29 +33,30 @@ class AppQLPreviewController: UIViewController {
super.init(nibName: nil, bundle: nil) super.init(nibName: nil, bundle: nil)
} }
required init?(coder: NSCoder) { @available(*, unavailable)
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated) super.viewWillAppear(animated)
if self.qlController == nil { if qlController == nil {
self.qlController = QLPreviewController() qlController = QLPreviewController()
self.qlController?.dataSource = self qlController?.dataSource = self
self.qlController?.delegate = self qlController?.delegate = self
self.qlController?.currentPreviewItemIndex = urls.firstIndex(of: selectedURL) ?? 0 qlController?.currentPreviewItemIndex = urls.firstIndex(of: selectedURL) ?? 0
self.present(self.qlController!, animated: true) present(qlController!, animated: true)
} }
} }
} }
extension AppQLPreviewController: QLPreviewControllerDataSource { extension AppQLPreviewController: QLPreviewControllerDataSource {
func numberOfPreviewItems(in _: QLPreviewController) -> Int { func numberOfPreviewItems(in _: QLPreviewController) -> Int {
return self.urls.count return urls.count
} }
func previewController(_: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem { func previewController(_: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
return self.urls[index] as QLPreviewItem return urls[index] as QLPreviewItem
} }
} }
@ -64,18 +65,17 @@ extension AppQLPreviewController : QLPreviewControllerDelegate {
.createCopy .createCopy
} }
func previewControllerWillDismiss(_ controller: QLPreviewController) { func previewControllerWillDismiss(_: QLPreviewController) {
self.dismiss(animated: true) dismiss(animated: true)
} }
} }
struct TransparentBackground: UIViewControllerRepresentable { struct TransparentBackground: UIViewControllerRepresentable {
public func makeUIViewController(context: Context) -> UIViewController { public func makeUIViewController(context _: Context) -> UIViewController {
return TransparentController() return TransparentController()
} }
public func updateUIViewController(_ uiViewController: UIViewController, context: Context) { public func updateUIViewController(_: UIViewController, context _: Context) {}
}
class TransparentController: UIViewController { class TransparentController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {

View file

@ -44,7 +44,7 @@ class ShareViewController: UIViewController {
childView.view.topAnchor.constraint(equalTo: self.view.topAnchor), childView.view.topAnchor.constraint(equalTo: self.view.topAnchor),
childView.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor), childView.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
childView.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor), childView.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
childView.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor) childView.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
]) ])
} }
} }

View file

@ -11,7 +11,7 @@ public struct FontPicker: UIViewControllerRepresentable {
self.dismiss = dismiss self.dismiss = dismiss
} }
public func fontPickerViewControllerDidCancel(_ viewController: UIFontPickerViewController) { public func fontPickerViewControllerDidCancel(_: UIFontPickerViewController) {
dismiss() dismiss()
} }
@ -33,5 +33,5 @@ public struct FontPicker: UIViewControllerRepresentable {
return controller return controller
} }
public func updateUIViewController(_ viewController: UIFontPickerViewController, context: Context) {} public func updateUIViewController(_: UIFontPickerViewController, context _: Context) {}
} }

View file

@ -5,8 +5,8 @@ private struct SecondaryColumnKey: EnvironmentKey {
static let defaultValue = false static let defaultValue = false
} }
extension EnvironmentValues { public extension EnvironmentValues {
public var isSecondaryColumn: Bool { var isSecondaryColumn: Bool {
get { self[SecondaryColumnKey.self] } get { self[SecondaryColumnKey.self] }
set { self[SecondaryColumnKey.self] = newValue } set { self[SecondaryColumnKey.self] = newValue }
} }

View file

@ -33,7 +33,7 @@ public class QuickLook: ObservableObject {
paths.append(path) paths.append(path)
} }
return paths.sorted { url1, url2 in return paths.sorted { url1, url2 in
return pathOrderMap[url1.lastPathComponent] ?? 0 < pathOrderMap[url2.lastPathComponent] ?? 0 pathOrderMap[url1.lastPathComponent] ?? 0 < pathOrderMap[url2.lastPathComponent] ?? 0
} }
}) })
withTransaction(transaction) { withTransaction(transaction) {

View file

@ -78,7 +78,8 @@ public class UserPreferences: ObservableObject {
} }
set { set {
if let font = newValue, if let font = newValue,
let data = try? NSKeyedArchiver.archivedData(withRootObject: font, requiringSecureCoding: false) { let data = try? NSKeyedArchiver.archivedData(withRootObject: font, requiringSecureCoding: false)
{
chosenFontData = data chosenFontData = data
} else { } else {
chosenFontData = nil chosenFontData = nil

View file

@ -32,8 +32,8 @@ struct NotificationRowView: View {
} }
} }
} }
.alignmentGuide(.listRowSeparatorLeading) { viewDimensions in .alignmentGuide(.listRowSeparatorLeading) { _ in
return -100 -100
} }
} }

View file

@ -1,6 +1,6 @@
import DesignSystem
import Models import Models
import SwiftUI import SwiftUI
import DesignSystem
extension Models.Notification.NotificationType { extension Models.Notification.NotificationType {
func label(count: Int) -> LocalizedStringKey { func label(count: Int) -> LocalizedStringKey {

View file

@ -1,6 +1,6 @@
import AVKit import AVKit
import SwiftUI
import Env import Env
import SwiftUI
class VideoPlayerViewModel: ObservableObject { class VideoPlayerViewModel: ObservableObject {
@Published var player: AVPlayer? @Published var player: AVPlayer?

View file

@ -86,7 +86,8 @@ struct StatusRowContextMenu: View {
} }
} label: { } label: {
if let statusLanguage = viewModel.status.language, if let statusLanguage = viewModel.status.language,
let lanugageName = Locale.current.localizedString(forLanguageCode: statusLanguage) { let lanugageName = Locale.current.localizedString(forLanguageCode: statusLanguage)
{
Label("status.action.translate-from-\(lanugageName)", systemImage: "captions.bubble") Label("status.action.translate-from-\(lanugageName)", systemImage: "captions.bubble")
} else { } else {
Label("status.action.translate", systemImage: "captions.bubble") Label("status.action.translate", systemImage: "captions.bubble")

View file

@ -317,7 +317,8 @@ public struct StatusRowView: View {
ProgressView() ProgressView()
} else { } else {
if let statusLanguage = status.language, if let statusLanguage = status.language,
let lanugageName = Locale.current.localizedString(forLanguageCode: statusLanguage) { let lanugageName = Locale.current.localizedString(forLanguageCode: statusLanguage)
{
Text("status.action.translate-from-\(lanugageName)") Text("status.action.translate-from-\(lanugageName)")
} else { } else {
Text("status.action.translate") Text("status.action.translate")