Configured and applied SwiftFormat

This commit is contained in:
Stefan Ceriu
2022-09-27 10:17:22 +03:00
committed by Stefan Ceriu
parent ff2e6ddfa7
commit 43c28d23b7
663 changed files with 2329 additions and 2840 deletions
@@ -1,4 +1,4 @@
//
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,15 +14,14 @@
// limitations under the License.
//
import SwiftUI
import Combine
import SwiftUI
typealias AllChatsOnboardingViewModelType = StateStoreViewModel<AllChatsOnboardingViewState,
Never,
AllChatsOnboardingViewAction>
Never,
AllChatsOnboardingViewAction>
class AllChatsOnboardingViewModel: AllChatsOnboardingViewModelType, AllChatsOnboardingViewModelProtocol {
// MARK: - Properties
// MARK: Private
@@ -34,7 +33,7 @@ class AllChatsOnboardingViewModel: AllChatsOnboardingViewModelType, AllChatsOnbo
// MARK: - Setup
static func makeAllChatsOnboardingViewModel() -> AllChatsOnboardingViewModelProtocol {
return AllChatsOnboardingViewModel()
AllChatsOnboardingViewModel()
}
private init() {
@@ -42,7 +41,7 @@ class AllChatsOnboardingViewModel: AllChatsOnboardingViewModelType, AllChatsOnbo
}
private static func defaultState() -> AllChatsOnboardingViewState {
return AllChatsOnboardingViewState(pages: [
AllChatsOnboardingViewState(pages: [
AllChatsOnboardingPageData(image: Asset.Images.allChatsOnboarding1.image,
title: VectorL10n.allChatsOnboardingPageTitle1,
message: VectorL10n.allChatsOnboardingPageMessage1),
@@ -1,4 +1,4 @@
//
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,6 @@
import Foundation
protocol AllChatsOnboardingViewModelProtocol {
var completion: ((AllChatsOnboardingViewModelResult) -> Void)? { get set }
static func makeAllChatsOnboardingViewModel() -> AllChatsOnboardingViewModelProtocol
var context: AllChatsOnboardingViewModelType.Context { get }
@@ -14,12 +14,11 @@
// limitations under the License.
//
import SwiftUI
import CommonKit
import SwiftUI
/// All Chats onboarding screen
final class AllChatsOnboardingCoordinator: NSObject, Coordinator, Presentable {
// MARK: - Properties
// MARK: Private
@@ -42,8 +41,8 @@ final class AllChatsOnboardingCoordinator: NSObject, Coordinator, Presentable {
let viewModel = AllChatsOnboardingViewModel.makeAllChatsOnboardingViewModel()
let view = AllChatsOnboarding(viewModel: viewModel.context)
self.viewModel = viewModel
self.hostingController = VectorHostingController(rootView: view)
self.indicatorPresenter = UserIndicatorTypePresenter(presentingViewController: hostingController)
hostingController = VectorHostingController(rootView: view)
indicatorPresenter = UserIndicatorTypePresenter(presentingViewController: hostingController)
super.init()
@@ -65,7 +64,7 @@ final class AllChatsOnboardingCoordinator: NSObject, Coordinator, Presentable {
}
func toPresentable() -> UIViewController {
return self.hostingController
hostingController
}
// MARK: - Private
@@ -87,9 +86,7 @@ final class AllChatsOnboardingCoordinator: NSObject, Coordinator, Presentable {
// MARK: - UIAdaptivePresentationControllerDelegate
extension AllChatsOnboardingCoordinator: UIAdaptivePresentationControllerDelegate {
func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
completion?()
}
}
@@ -26,7 +26,6 @@ import Foundation
/// Each bridge should be removed once the underlying Coordinator has been integrated by another Coordinator.
@objcMembers
final class AllChatsOnboardingCoordinatorBridgePresenter: NSObject {
// MARK: - Properties
// MARK: Private
@@ -53,7 +52,7 @@ final class AllChatsOnboardingCoordinatorBridgePresenter: NSObject {
}
func dismiss(animated: Bool, completion: (() -> Void)?) {
guard let coordinator = self.coordinator else {
guard let coordinator = coordinator else {
return
}
coordinator.toPresentable().dismiss(animated: animated) {
@@ -62,4 +61,3 @@ final class AllChatsOnboardingCoordinatorBridgePresenter: NSObject {
}
}
}
@@ -1,4 +1,4 @@
//
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,6 @@
import SwiftUI
struct AllChatsOnboarding: View {
// MARK: - Properties
// MARK: Private
@@ -36,12 +35,12 @@ struct AllChatsOnboarding: View {
.foregroundColor(theme.colors.primaryContent)
.padding()
TabView(selection: $selectedTab) {
ForEach(viewModel.viewState.pages.indices) { index in
ForEach(viewModel.viewState.pages.indices, id: \.self) { index in
let page = viewModel.viewState.pages[index]
AllChatsOnboardingPage(image: page.image,
title: page.title,
message: page.message)
.tag(index)
.tag(index)
}
}
.tabViewStyle(PageTabViewStyle(indexDisplayMode: .automatic))
@@ -61,7 +60,7 @@ struct AllChatsOnboarding: View {
// MARK: - Private
private func onCallToAction() {
if (selectedTab == viewModel.viewState.pages.count - 1) {
if selectedTab == viewModel.viewState.pages.count - 1 {
viewModel.send(viewAction: .cancel)
} else {
withAnimation {
@@ -1,4 +1,4 @@
//
//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,6 @@
import SwiftUI
struct AllChatsOnboardingPage: View {
// MARK: - Properties
let image: UIImage
@@ -55,7 +54,7 @@ struct AllChatsOnboardingPage_Previews: PreviewProvider {
preview.theme(.dark).preferredColorScheme(.dark)
}
static private var preview: some View {
private static var preview: some View {
AllChatsOnboardingPage(image: Asset.Images.allChatsOnboarding1.image,
title: VectorL10n.allChatsOnboardingPageTitle1,
message: VectorL10n.allChatsOnboardingPageMessage1)