Extracted SectionWithoutBackground

This commit is contained in:
dankito 2020-09-23 23:13:29 +02:00
parent ba260b4826
commit 3988e7ebac
4 changed files with 41 additions and 5 deletions

View File

@ -22,6 +22,7 @@
361116A62505430500315620 /* KeychainPasswordItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 361116A52505430400315620 /* KeychainPasswordItem.swift */; }; 361116A62505430500315620 /* KeychainPasswordItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 361116A52505430400315620 /* KeychainPasswordItem.swift */; };
361116A8250562BE00315620 /* FaceIDButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 361116A7250562BE00315620 /* FaceIDButton.swift */; }; 361116A8250562BE00315620 /* FaceIDButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 361116A7250562BE00315620 /* FaceIDButton.swift */; };
361116AA250562CF00315620 /* TouchIDButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 361116A9250562CF00315620 /* TouchIDButton.swift */; }; 361116AA250562CF00315620 /* TouchIDButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 361116A9250562CF00315620 /* TouchIDButton.swift */; };
36428CFF251BEC4C009DE1AE /* SectionWithoutBackground.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36428CFE251BEC4C009DE1AE /* SectionWithoutBackground.swift */; };
3642F00A2500F5AE005186FE /* Divider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3642F0092500F5AE005186FE /* Divider.swift */; }; 3642F00A2500F5AE005186FE /* Divider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3642F0092500F5AE005186FE /* Divider.swift */; };
3642F00C25010021005186FE /* UIKitActivityIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3642F00B25010021005186FE /* UIKitActivityIndicator.swift */; }; 3642F00C25010021005186FE /* UIKitActivityIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3642F00B25010021005186FE /* UIKitActivityIndicator.swift */; };
3642F01425018BA9005186FE /* TabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3642F01325018BA9005186FE /* TabBarController.swift */; }; 3642F01425018BA9005186FE /* TabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3642F01325018BA9005186FE /* TabBarController.swift */; };
@ -168,6 +169,7 @@
361116A52505430400315620 /* KeychainPasswordItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainPasswordItem.swift; sourceTree = "<group>"; }; 361116A52505430400315620 /* KeychainPasswordItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainPasswordItem.swift; sourceTree = "<group>"; };
361116A7250562BE00315620 /* FaceIDButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FaceIDButton.swift; sourceTree = "<group>"; }; 361116A7250562BE00315620 /* FaceIDButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FaceIDButton.swift; sourceTree = "<group>"; };
361116A9250562CF00315620 /* TouchIDButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TouchIDButton.swift; sourceTree = "<group>"; }; 361116A9250562CF00315620 /* TouchIDButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TouchIDButton.swift; sourceTree = "<group>"; };
36428CFE251BEC4C009DE1AE /* SectionWithoutBackground.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SectionWithoutBackground.swift; sourceTree = "<group>"; };
3642F0092500F5AE005186FE /* Divider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Divider.swift; sourceTree = "<group>"; }; 3642F0092500F5AE005186FE /* Divider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Divider.swift; sourceTree = "<group>"; };
3642F00B25010021005186FE /* UIKitActivityIndicator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIKitActivityIndicator.swift; sourceTree = "<group>"; }; 3642F00B25010021005186FE /* UIKitActivityIndicator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIKitActivityIndicator.swift; sourceTree = "<group>"; };
3642F01325018BA9005186FE /* TabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarController.swift; sourceTree = "<group>"; }; 3642F01325018BA9005186FE /* TabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarController.swift; sourceTree = "<group>"; };
@ -560,6 +562,7 @@
361116A9250562CF00315620 /* TouchIDButton.swift */, 361116A9250562CF00315620 /* TouchIDButton.swift */,
3684EB8A2508F6F00001139E /* SearchBarWithLabel.swift */, 3684EB8A2508F6F00001139E /* SearchBarWithLabel.swift */,
3684EB91250FD4AF0001139E /* LabelledValue.swift */, 3684EB91250FD4AF0001139E /* LabelledValue.swift */,
36428CFE251BEC4C009DE1AE /* SectionWithoutBackground.swift */,
); );
path = views; path = views;
sourceTree = "<group>"; sourceTree = "<group>";
@ -735,6 +738,7 @@
36BE068D24CE41E700CBBB68 /* Styles.swift in Sources */, 36BE068D24CE41E700CBBB68 /* Styles.swift in Sources */,
3642F00C25010021005186FE /* UIKitActivityIndicator.swift in Sources */, 3642F00C25010021005186FE /* UIKitActivityIndicator.swift in Sources */,
36E21ECB24D88DF000649DC8 /* UIKitExtensions.swift in Sources */, 36E21ECB24D88DF000649DC8 /* UIKitExtensions.swift in Sources */,
36428CFF251BEC4C009DE1AE /* SectionWithoutBackground.swift in Sources */,
360782C524E541970098FEFE /* ScaleImageView.swift in Sources */, 360782C524E541970098FEFE /* ScaleImageView.swift in Sources */,
366FA4E224C4ED6C0094F009 /* EnterTanDialog.swift in Sources */, 366FA4E224C4ED6C0094F009 /* EnterTanDialog.swift in Sources */,
361116AA250562CF00315620 /* TouchIDButton.swift in Sources */, 361116AA250562CF00315620 /* TouchIDButton.swift in Sources */,

View File

@ -91,7 +91,7 @@ struct AccountTransactionsDialog: View {
} }
if showFetchAllTransactionsView { if showFetchAllTransactionsView {
Section { SectionWithoutBackground {
HStack(alignment: .center) { HStack(alignment: .center) {
Spacer() Spacer()
@ -101,8 +101,6 @@ struct AccountTransactionsDialog: View {
} }
.padding(.horizontal, 6) .padding(.horizontal, 6)
} }
.frame(maxWidth: .infinity, minHeight: 44) // has to have at least a height of 44 (iOS 14; iOS 13: 40), otherwise a white line at bottom gets displayed
.removeListInsets()
} }
if showTransactionsList { if showTransactionsList {

View File

@ -26,10 +26,9 @@ struct AccountsDialog: View {
BankListItem(bank: bank) BankListItem(bank: bank)
} }
Section { SectionWithoutBackground {
AddAccountButtonView() AddAccountButtonView()
} }
.removeSectionBackground()
} }
} }

View File

@ -0,0 +1,35 @@
import SwiftUI
struct SectionWithoutBackground<Content: View>: View {
private let content: () -> Content
init(@ViewBuilder _ content: @escaping () -> Content) {
self.content = content
}
var body: some View {
Section {
content()
}
.frame(maxWidth: .infinity, minHeight: 44) // has to have at least a height of 44 (iOS 14; iOS 13: 40), otherwise a white line at bottom gets displayed
.removeSectionBackground()
}
}
struct SectionWithoutBackground_Previews: PreviewProvider {
static var previews: some View {
Form {
SectionWithoutBackground {
Text("Hello")
}
}
}
}