Update files following swiftformat upgrade

This commit is contained in:
Stefan Ceriu
2026-01-27 08:47:03 +02:00
committed by Stefan Ceriu
parent fe189fcfed
commit 23062901c0
343 changed files with 1502 additions and 1048 deletions
@@ -13,7 +13,7 @@ protocol AlertProtocol {
}
extension View {
func alert<Item, Actions, Message>(item: Binding<Item?>, @ViewBuilder actions: (Item) -> Actions, @ViewBuilder message: (Item) -> Message) -> some View where Item: AlertProtocol, Actions: View, Message: View {
func alert<Item: AlertProtocol, Actions: View, Message: View>(item: Binding<Item?>, @ViewBuilder actions: (Item) -> Actions, @ViewBuilder message: (Item) -> Message) -> some View {
let binding = Binding<Bool>(get: {
item.wrappedValue != nil
}, set: { newValue in
@@ -25,7 +25,7 @@ extension View {
}
// periphery: ignore - not used yet but might be useful
func alert<Item, Actions>(item: Binding<Item?>, @ViewBuilder actions: (Item) -> Actions) -> some View where Item: AlertProtocol, Actions: View {
func alert<Item: AlertProtocol, Actions: View>(item: Binding<Item?>, @ViewBuilder actions: (Item) -> Actions) -> some View {
let binding = Binding<Bool>(get: {
item.wrappedValue != nil
}, set: { newValue in
@@ -9,7 +9,7 @@
import Foundation
extension AttributedString {
// faster than doing `String(characters)`: https://forums.swift.org/t/attributedstring-to-string/61667
/// faster than doing `String(characters)`: https://forums.swift.org/t/attributedstring-to-string/61667
var string: String {
String(characters[...])
}
@@ -13,9 +13,9 @@ protocol ConfirmationDialogProtocol {
}
extension View {
func confirmationDialog<Item, Actions>(item: Binding<Item?>,
titleVisibility: Visibility = .automatic,
@ViewBuilder actions: (Item) -> Actions) -> some View where Item: ConfirmationDialogProtocol, Actions: View {
func confirmationDialog<Item: ConfirmationDialogProtocol, Actions: View>(item: Binding<Item?>,
titleVisibility: Visibility = .automatic,
@ViewBuilder actions: (Item) -> Actions) -> some View {
let binding = Binding<Bool>(get: {
item.wrappedValue != nil
}, set: { newValue in
@@ -27,10 +27,10 @@ extension View {
}
// periphery: ignore - not used yet but might be useful
func confirmationDialog<Item, Actions, Message>(item: Binding<Item?>,
titleVisibility: Visibility = .automatic,
@ViewBuilder actions: (Item) -> Actions,
@ViewBuilder message: (Item) -> Message) -> some View where Item: ConfirmationDialogProtocol, Actions: View, Message: View {
func confirmationDialog<Item: ConfirmationDialogProtocol, Actions: View, Message: View>(item: Binding<Item?>,
titleVisibility: Visibility = .automatic,
@ViewBuilder actions: (Item) -> Actions,
@ViewBuilder message: (Item) -> Message) -> some View {
let binding = Binding<Bool>(get: {
item.wrappedValue != nil
}, set: { newValue in
+2 -2
View File
@@ -67,8 +67,8 @@ extension Date {
}
private extension DateFormatter {
// There doesn't appear to be a way to get "Today" out of
// `Date.RelativeFormatStyle` so use the old way instead 😐
/// There doesn't appear to be a way to get "Today" out of
/// `Date.RelativeFormatStyle` so use the old way instead 😐
static let relative: DateFormatter = {
let formatter = DateFormatter()
formatter.doesRelativeDateFormatting = true
@@ -197,5 +197,7 @@ extension NSItemProvider {
}
private extension NSString {
var hasPathExtension: Bool { !pathExtension.isEmpty }
var hasPathExtension: Bool {
!pathExtension.isEmpty
}
}
@@ -7,7 +7,6 @@
//
import Foundation
import OrderedCollections
extension OrderedSet {
@@ -9,7 +9,7 @@
import SwiftUI
extension Section where Parent == Color, Content == EmptyView, Footer == EmptyView {
// An empty section whose purpose is to keep Form's background color when there is no content into it.
/// An empty section whose purpose is to keep Form's background color when there is no content into it.
static var empty: some View {
Section {
EmptyView()
+23 -6
View File
@@ -135,12 +135,29 @@ extension URL {
// MARK: Mocks
static var mockMXCAudio: URL { "mxc://matrix.org/1234567890AuDiO" }
static var mockMXCFile: URL { "mxc://matrix.org/1234567890FiLe" }
static var mockMXCImage: URL { "mxc://matrix.org/1234567890ImAgE" }
static var mockMXCVideo: URL { "mxc://matrix.org/1234567890ViDeO" }
static var mockMXCAvatar: URL { "mxc://matrix.org/1234567890AvAtAr" }
static var mockMXCUserAvatar: URL { "mxc://matrix.org/1234567890AvAtArUsEr" }
static var mockMXCAudio: URL {
"mxc://matrix.org/1234567890AuDiO"
}
static var mockMXCFile: URL {
"mxc://matrix.org/1234567890FiLe"
}
static var mockMXCImage: URL {
"mxc://matrix.org/1234567890ImAgE"
}
static var mockMXCVideo: URL {
"mxc://matrix.org/1234567890ViDeO"
}
static var mockMXCAvatar: URL {
"mxc://matrix.org/1234567890AvAtAr"
}
static var mockMXCUserAvatar: URL {
"mxc://matrix.org/1234567890AvAtArUsEr"
}
}
// MARK: - Helpers
@@ -96,7 +96,7 @@ extension XCTestCase {
timeout: TimeInterval = 10,
message: String? = nil) -> DeferredFulfillment<P.Output> {
var expectedOrder = transitionValues
let deferred = deferFulfillment(publisher, timeout: timeout, message: message) { value in
return deferFulfillment(publisher, timeout: timeout, message: message) { value in
let receivedValue = value[keyPath: keyPath]
if let index = expectedOrder.firstIndex(where: { $0 == receivedValue }), index == 0 {
expectedOrder.remove(at: index)
@@ -104,8 +104,6 @@ extension XCTestCase {
return expectedOrder.isEmpty
}
return deferred
}
/// XCTest utility that assists in subscribing to an async sequence and deferring the fulfilment and results until some other actions have been performed.
@@ -120,15 +118,13 @@ extension XCTestCase {
timeout: TimeInterval = 10,
message: String? = nil) -> DeferredFulfillment<Value> {
var expectedOrder = transitionValues
let deferred = deferFulfillment(asyncSequence, timeout: timeout, message: message) { value in
return deferFulfillment(asyncSequence, timeout: timeout, message: message) { value in
if let index = expectedOrder.firstIndex(where: { $0 == value }), index == 0 {
expectedOrder.remove(at: index)
}
return expectedOrder.isEmpty
}
return deferred
}
/// XCTest utility that assists in subscribing to a publisher and deferring the failure for a particular value until some other actions have been performed.