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
@@ -24,7 +24,7 @@ struct RoomMembersListScreenMemberCell: View {
Button {
context.send(viewAction: .selectMember(id: member.id))
} label: {
HStack {
HStack(spacing: 8) {
LoadableAvatarImage(url: member.avatarURL,
name: member.name ?? "",
contentID: member.id,
@@ -36,26 +36,24 @@ struct RoomMembersListScreenMemberCell: View {
.font(.compound.bodyMDSemibold)
.foregroundColor(.compound.textPrimary)
.lineLimit(1)
Spacer()
}
.frame(maxWidth: .infinity, alignment: .leading)
.accessibilityElement(children: .combine)
}
}
}
struct RoomMembersListMemberCell_Previews: PreviewProvider, TestablePreview {
static let members: [RoomMemberProxyMock] = [
.mockAlice,
.mockBob,
.mockCharlie
]
static let viewModel = RoomMembersListScreenViewModel(roomProxy: RoomProxyMock(with: .init(displayName: "Some room", members: members)),
mediaProvider: MockMediaProvider(),
userIndicatorController: ServiceLocator.shared.userIndicatorController)
static var previews: some View {
let members: [RoomMemberProxyMock] = [
.mockAlice,
.mockBob,
.mockCharlie
]
let viewModel = RoomMembersListScreenViewModel(roomProxy: RoomProxyMock(with: .init(displayName: "Some room", members: members)),
mediaProvider: MockMediaProvider(),
userIndicatorController: ServiceLocator.shared.userIndicatorController)
return VStack {
VStack(spacing: 12) {
ForEach(members, id: \.userID) { member in
RoomMembersListScreenMemberCell(member: .init(withProxy: member), context: viewModel.context)
}