Add SwiftLint rule to enforce stack spacing. (#2080)

Xcode 15 changes the default behaviour and given we're always working from designs, we shouldn't rely on it for our layout.
This commit is contained in:
Doug
2023-11-14 12:38:38 +00:00
committed by GitHub
parent 752ad66397
commit 2c1e61a1bc
123 changed files with 289 additions and 293 deletions
@@ -86,7 +86,7 @@ struct MapLibreStaticMapView<PinAnnotation: View>: View {
} label: {
placeholderImage
.overlay {
VStack {
VStack(spacing: 0) {
Image(systemName: "arrow.clockwise")
Text(L10n.actionStaticMapLoad)
}
@@ -87,7 +87,7 @@ struct ShimmerOverlay_Previews: PreviewProvider, TestablePreview {
userIndicatorController: ServiceLocator.shared.userIndicatorController)
static var previews: some View {
VStack {
VStack(spacing: 0) {
ForEach(0...8, id: \.self) { _ in
HomeScreenRoomCell(room: .placeholder(), context: viewModel.context, isSelected: false)
}
@@ -97,7 +97,7 @@ struct FormButtonStyle: PrimitiveButtonStyle {
var accessory: FormRowAccessory?
func makeBody(configuration: Configuration) -> some View {
HStack {
HStack(spacing: 8) {
configuration.label
.labelStyle(FormRowLabelStyle(role: configuration.role))
.foregroundColor(.compound.textPrimary)
@@ -126,7 +126,7 @@ struct FormActionButtonStyle: ButtonStyle {
let title: String
func makeBody(configuration: Configuration) -> some View {
VStack {
VStack(spacing: 8) {
configuration.label
.buttonStyle(.plain)
.foregroundColor(.compound.textPrimary)
@@ -61,7 +61,7 @@ struct FormRowLabelStyle: LabelStyle {
struct FormRowLabelStyle_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
VStack(alignment: .leading) {
VStack(alignment: .leading, spacing: 12) {
Label("Person", systemImage: "person")
.labelStyle(FormRowLabelStyle())
@@ -50,7 +50,7 @@ struct FullscreenDialog<Content: View, BottomContent: View>: View {
var standardLayout: some View {
GeometryReader { geometry in
ScrollView {
VStack {
VStack(spacing: 0) {
Spacer()
.frame(height: UIConstants.spacerHeight(in: geometry))
@@ -62,7 +62,7 @@ struct FullscreenDialog<Content: View, BottomContent: View>: View {
}
.scrollBounceBehavior(.basedOnSize)
.safeAreaInset(edge: .bottom) {
VStack {
VStack(spacing: 0) {
bottomContent()
.readableFrame()
.padding(.horizontal, horizontalPadding)
@@ -81,7 +81,7 @@ struct FullscreenDialog<Content: View, BottomContent: View>: View {
var accessibilityLayout: some View {
GeometryReader { geometry in
ScrollView {
VStack {
VStack(spacing: 0) {
Spacer()
.frame(height: UIConstants.spacerHeight(in: geometry))
@@ -30,7 +30,7 @@ struct UserIndicatorModalView: View {
ProgressView(value: progressFraction)
}
HStack {
HStack(spacing: 8) {
if let iconName = indicator.iconName {
Image(systemName: iconName)
.font(.compound.bodyLG)
@@ -124,7 +124,7 @@ private struct WaveformShape: Shape {
struct EstimatedWaveformView_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
// Wrap the WaveformView in a VStack otherwise the preview test will fail (because of Prefire / GeometryReader)
VStack {
VStack(spacing: 0) {
EstimatedWaveformView(waveform: EstimatedWaveform.mockWaveform, progress: 0.5)
.frame(width: 140, height: 50)
}
@@ -110,12 +110,12 @@ extension VoiceMessageButton.State {
struct VoiceMessageButton_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
VStack {
HStack {
VStack(spacing: 8) {
HStack(spacing: 8) {
VoiceMessageButton(state: .paused, size: .small, action: { })
VoiceMessageButton(state: .paused, size: .medium, action: { })
}
HStack {
HStack(spacing: 8) {
VoiceMessageButton(state: .playing, size: .small, action: { })
VoiceMessageButton(state: .playing, size: .medium, action: { })
}