diff --git a/CHDataManagement/Views/Posts/PostImageGalleryView.swift b/CHDataManagement/Views/Posts/PostImageGalleryView.swift index 78298c3..3f20a2e 100644 --- a/CHDataManagement/Views/Posts/PostImageGalleryView.swift +++ b/CHDataManagement/Views/Posts/PostImageGalleryView.swift @@ -14,9 +14,9 @@ private struct NavigationIcon: View { .padding(5) .padding(edge, 2) .fontWeight(.light) - .foregroundStyle(.white) + .foregroundStyle(Color.white.opacity(0.8)) .frame(width: 30, height: 30) - .background(Color.black.opacity(0.6).clipShape(Circle())) + .background(Color.black.opacity(0.7).clipShape(Circle())) } } @@ -49,14 +49,18 @@ struct PostImageGalleryView: View { .padding(.bottom, 10) } } - Button(action: { showImagePicker = true }) { - Image(systemSymbol: .plusCircleFill) - .resizable() - .renderingMode(.template) - .foregroundStyle(.blue.opacity(0.7)) - .frame(width: 30, height: 30) - .padding() - } + HStack(spacing: 5) { + Button(action: shiftBack) { + NavigationIcon(symbol: .arrowTurnUpLeft, edge: .trailing) + } + Button(action: shiftForward) { + NavigationIcon(symbol: .arrowTurnUpRight, edge: .leading) + } + Spacer() + Button(action: { showImagePicker = true }) { + NavigationIcon(symbol: .plus, edge: .all) + } + }.padding() } .buttonStyle(.plain) .foregroundStyle(.blue) @@ -100,6 +104,22 @@ struct PostImageGalleryView: View { currentIndex = 0 } } + + private func shiftBack() { + guard currentIndex > 0 else { + return + } + post.images.swapAt(currentIndex, currentIndex-1) + currentIndex -= 1 + } + + private func shiftForward() { + guard currentIndex < post.images.count - 1 else { + return + } + post.images.swapAt(currentIndex, currentIndex+1) + currentIndex += 1 + } } #Preview(traits: .fixedLayout(width: 300, height: 250)) {