Skip to content

Instantly share code, notes, and snippets.



Created Oct 15, 2019
What would you like to do?
Basic `PageControl` in SwiftUI without any UIKit components.
struct PageControl: View {
var numberOfPages: Int
@Binding var currentPage: Int
var body: some View {
HStack {
ForEach(0..<numberOfPages) { index in
.frame(width: 8, height: 8)
.foregroundColor(index == self.currentPage ? .accentColor : .white)
.onTapGesture(perform: { self.currentPage = index })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.