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");
@@ -18,7 +18,6 @@ import SwiftUI
/// A modifier for showing the wait overlay view over a view.
struct WaitOverlayModifier: ViewModifier {
var allowUserInteraction: Bool
var show: Bool
var message: String?
@@ -27,15 +26,16 @@ struct WaitOverlayModifier: ViewModifier {
func body(content: Content) -> some View {
content
.modifier(WaitOverlay(
allowUserInteraction: allowUserInteraction,
message: message,
isLoading: show))
allowUserInteraction: allowUserInteraction,
message: message,
isLoading: show
))
}
}
extension View {
func waitOverlay(show: Bool, message: String? = nil, allowUserInteraction: Bool = true) -> some View {
self.modifier(WaitOverlayModifier(allowUserInteraction: allowUserInteraction, show: show, message: message))
modifier(WaitOverlayModifier(allowUserInteraction: allowUserInteraction, show: show, message: message))
}
}
@@ -44,7 +44,7 @@ struct WaitOverlay: ViewModifier {
// MARK: - Properties
var alignment: Alignment = .center
var allowUserInteraction: Bool = true
var allowUserInteraction = true
var message: String?
var isLoading: Bool
@@ -66,8 +66,7 @@ struct WaitOverlay: ViewModifier {
// MARK: - Public
public func body(content: Content) -> some View
{
public func body(content: Content) -> some View {
ZStack {
content
if isLoading {
@@ -89,7 +88,7 @@ struct WaitOverlay: ViewModifier {
}
.padding(12)
.background(RoundedRectangle(cornerRadius: 8, style: .continuous)
.fill(theme.colors.navigation.opacity(0.9)))
.fill(theme.colors.navigation.opacity(0.9)))
}
.edgesIgnoringSafeArea(.all)
.transition(.opacity)
@@ -103,24 +102,24 @@ struct WaitOverlay_Previews: PreviewProvider {
static var previews: some View {
Group {
VStack {
ThemableNavigationBar(title: nil, showBackButton: true, backAction: {}, closeAction: {})
ThemableNavigationBar(title: "Some Title", showBackButton: true, backAction: {}, closeAction: {})
ThemableNavigationBar(title: nil, showBackButton: false, backAction: {}, closeAction: {})
ThemableNavigationBar(title: "Some Title", showBackButton: false, backAction: {}, closeAction: {})
ThemableNavigationBar(title: nil, showBackButton: true, backAction: { }, closeAction: { })
ThemableNavigationBar(title: "Some Title", showBackButton: true, backAction: { }, closeAction: { })
ThemableNavigationBar(title: nil, showBackButton: false, backAction: { }, closeAction: { })
ThemableNavigationBar(title: "Some Title", showBackButton: false, backAction: { }, closeAction: { })
}
.modifier(WaitOverlay(isLoading: true))
VStack {
ThemableNavigationBar(title: nil, showBackButton: true, backAction: {}, closeAction: {})
ThemableNavigationBar(title: "Some Title", showBackButton: true, backAction: {}, closeAction: {})
ThemableNavigationBar(title: nil, showBackButton: false, backAction: {}, closeAction: {})
ThemableNavigationBar(title: "Some Title", showBackButton: false, backAction: {}, closeAction: {})
ThemableNavigationBar(title: nil, showBackButton: true, backAction: { }, closeAction: { })
ThemableNavigationBar(title: "Some Title", showBackButton: true, backAction: { }, closeAction: { })
ThemableNavigationBar(title: nil, showBackButton: false, backAction: { }, closeAction: { })
ThemableNavigationBar(title: "Some Title", showBackButton: false, backAction: { }, closeAction: { })
}
.modifier(WaitOverlay(alignment:.topLeading, isLoading: true))
.modifier(WaitOverlay(alignment: .topLeading, isLoading: true))
VStack {
ThemableNavigationBar(title: nil, showBackButton: true, backAction: {}, closeAction: {}).theme(.dark)
ThemableNavigationBar(title: "Some Title", showBackButton: true, backAction: {}, closeAction: {}).theme(.dark)
ThemableNavigationBar(title: nil, showBackButton: false, backAction: {}, closeAction: {}).theme(.dark)
ThemableNavigationBar(title: "Some Title", showBackButton: false, backAction: {}, closeAction: {}).theme(.dark)
ThemableNavigationBar(title: nil, showBackButton: true, backAction: { }, closeAction: { }).theme(.dark)
ThemableNavigationBar(title: "Some Title", showBackButton: true, backAction: { }, closeAction: { }).theme(.dark)
ThemableNavigationBar(title: nil, showBackButton: false, backAction: { }, closeAction: { }).theme(.dark)
ThemableNavigationBar(title: "Some Title", showBackButton: false, backAction: { }, closeAction: { }).theme(.dark)
}
.modifier(WaitOverlay(isLoading: true)).theme(.dark)