Skip to content

Instantly share code, notes, and snippets.

@rudrankriyam
Created October 9, 2020 20:05
Show Gist options
  • Select an option

  • Save rudrankriyam/fec27c4113a9d1fe993e0b8df7264ff9 to your computer and use it in GitHub Desktop.

Select an option

Save rudrankriyam/fec27c4113a9d1fe993e0b8df7264ff9 to your computer and use it in GitHub Desktop.
The new main view of gradient Game Raw
import SwiftUI
struct GGMainView: View {
@State private var showSheet = false
var body: some View {
VStack(spacing: 0) {
ZStack(alignment: .center) {
Text(RGBViewText.mainTitleText)
.tracking(1.0)
.font(.headline)
HStack {
Spacer()
CustomNavigationButton(imageName: TabViewText.settingsImageName, accessibilityLabel: TabViewText.settingsTabName, action: {
self.showSheet = true
})
}
.padding(.trailing)
}
.padding(.bottom, 8)
RGBView()
}
.sheet(isPresented: $showSheet, content: {
SettingsView()
})
}
}
struct CustomNavigationButton: View {
var imageName: String
var accessibilityLabel: String
var action: ()->()
var body: some View {
Button(action: {
action()
}, label: {
Image(systemName: imageName)
.font(.system(size: 20))
.frame(width: 40, height: 40, alignment: .center)
.foregroundColor(.mainColor)
.accessibility(label: Text(accessibilityLabel))
})
.buttonStyle(PlainButtonStyle())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment