Add SwiftFormat to the project. (#129)

* Run swiftformat for whitespace.
* Run swiftformat with some rules.
This commit is contained in:
Doug
2022-07-06 14:49:05 +01:00
committed by GitHub
parent 26d8affaa8
commit 02eb4b35e2
188 changed files with 759 additions and 717 deletions
@@ -6,8 +6,8 @@
// Copyright © 2022 Element. All rights reserved.
//
import Foundation
import Combine
import Foundation
class MockRoomTimelineController: RoomTimelineControllerProtocol {
@@ -40,18 +40,12 @@ class MockRoomTimelineController: RoomTimelineControllerProtocol {
senderDisplayName: "Bob")]
func paginateBackwards(_ count: UInt) async -> Result<Void, RoomTimelineControllerError> {
return .failure(.generic)
.failure(.generic)
}
func processItemAppearance(_ itemId: String) async {
}
func processItemAppearance(_ itemId: String) async { }
func processItemDisappearance(_ itemId: String) async {
}
func processItemDisappearance(_ itemId: String) async { }
func sendMessage(_ message: String) async {
}
func sendMessage(_ message: String) async { }
}
@@ -6,8 +6,8 @@
// Copyright © 2022 Element. All rights reserved.
//
import Foundation
import Combine
import Foundation
import UIKit
class RoomTimelineController: RoomTimelineControllerProtocol {
@@ -79,9 +79,7 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
}
}
func processItemDisappearance(_ itemId: String) {
}
func processItemDisappearance(_ itemId: String) { }
func sendMessage(_ message: String) async {
switch await timelineProvider.sendMessage(message) {
@@ -6,8 +6,8 @@
// Copyright © 2022 Element. All rights reserved.
//
import Foundation
import Combine
import Foundation
enum RoomTimelineControllerCallback {
case updatedTimelineItems
@@ -6,8 +6,8 @@
// Copyright © 2022 Element. All rights reserved.
//
import Foundation
import Combine
import Foundation
class RoomTimelineProvider: RoomTimelineProviderProtocol {
private let roomProxy: RoomProxyProtocol
@@ -21,13 +21,13 @@ class RoomTimelineProvider: RoomTimelineProviderProtocol {
self.roomProxy.callbacks
.receive(on: DispatchQueue.main)
.sink { [weak self] callback in
guard let self = self else { return }
guard let self = self else { return }
switch callback {
case .updatedMessages:
self.callbacks.send(.updatedMessages)
}
}.store(in: &cancellables)
switch callback {
case .updatedMessages:
self.callbacks.send(.updatedMessages)
}
}.store(in: &cancellables)
}
var messages: [RoomMessageProtocol] {
@@ -6,8 +6,8 @@
// Copyright © 2022 Element. All rights reserved.
//
import Foundation
import Combine
import Foundation
enum RoomTimelineProviderCallback {
case updatedMessages
@@ -26,5 +26,5 @@ protocol RoomTimelineProviderProtocol {
func paginateBackwards(_ count: UInt) async -> Result<Void, RoomTimelineProviderError>
func sendMessage(_ message: String) async -> Result<Void, RoomTimelineProviderError>
func sendMessage(_ message: String) async -> Result<Void, RoomTimelineProviderError>
}
@@ -8,6 +8,4 @@
import Foundation
protocol DecorationTimelineItemProtocol: RoomTimelineItemProtocol {
}
protocol DecorationTimelineItemProtocol: RoomTimelineItemProtocol { }
@@ -42,6 +42,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
}
// MARK: - Private
private func buildTextTimelineItemFromMessage(_ message: TextRoomMessage,
_ isOutgoing: Bool,
_ showSenderDetails: Bool,