Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jordibruin/bab942539bce098ad343b3a422423586 to your computer and use it in GitHub Desktop.
Save jordibruin/bab942539bce098ad343b3a422423586 to your computer and use it in GitHub Desktop.
sam
//
// SamView.swift
// CloudKit-UI-test
//
// Created by Jordi Bruin on 03/07/2020.
// Copyright © 2020 Good Snooze. All rights reserved.
//
import SwiftUI
struct SamView: View {
var body: some View {
TabView {
FeedView()
NewView()
DoneView()
}
.accentColor(Color.orange)
}
}
struct SamView_Previews: PreviewProvider {
static var previews: some View {
SamView()
}
}
struct FeedView: View {
var body: some View {
NavigationView {
ScrollView {
ForEach((1...10), id: \.self) {_ in
VStack {
HStack {
Color(.green)
.frame(width: 50, height: 50)
.cornerRadius(25)
VStack {
Text("Joe Jackson")
Text("UX Designer")
.opacity(0.9)
}
Spacer()
VStack {
Text("18:30")
Text("July 1")
}
}
.padding()
Divider()
VStack(alignment: .leading) {
Text("Mileage Registration")
.bold()
.font(.system(size: 22, weight: .bold, design: .rounded))
Text("Mileage registration is the least used feature of our product and should be removed from our service")
.fixedSize(horizontal: false, vertical: true)
.lineLimit(4)
}
.padding()
Divider()
VStack(spacing: 20) {
VotingBar(emoji: "👍🏻", text:"True, remove it")
VotingBar(emoji: "👎", text:"False, we keep it")
}
.padding(20)
}
.background(Color.white)
.cornerRadius(8)
.shadow(color: Color.gray.opacity(0.2), radius: 9, x: 0, y: 0)
.padding(12)
}
.navigationBarTitle("Validate", displayMode: .inline)
.navigationBarItems(leading:
Image(systemName: "person.crop.square")
.font(.system(size: 28, weight: .light, design: .default)))
}
}
.tabItem {
Image(systemName: "globe")
.font(.title)
Text("Live")
}
}
}
struct VotingBar: View {
var emoji: String = ""
var text: String = ""
var body: some View {
VStack {
HStack {
Text(emoji)
Text(text)
Spacer()
Text("50%")
}
ZStack(alignment: .leading) {
RoundedRectangle(cornerRadius: 2)
.foregroundColor(Color.black.opacity(0.1))
.frame(height: 4)
RoundedRectangle(cornerRadius: 2)
.foregroundColor(Color.black.opacity(0.4))
.frame(width: 150, height: 4)
}
}
}
}
struct NewView: View {
var body: some View {
VStack {
Text("New")
}
.tabItem {
Image(systemName: "plus.rectangle")
.font(.title)
Text("New")
}
}
}
struct DoneView: View {
var body: some View {
VStack {
Text("Done")
}
.tabItem {
Image(systemName: "cube.box")
.font(.title)
Text("Done")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment