Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"images" : [
{
"filename" : "light.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "dark.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "light@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "dark@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "light@3x.png",
"idiom" : "universal",
"scale" : "3x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "dark@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 11 additions & 9 deletions CoffeeTracker/CoffeeTracker/Beans/BeanDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import SwiftUI

struct BeanDetailView: View {
@Environment(\.colorScheme) private var colorScheme

@State private var showEditView = false

var bean: BeanModel
Expand Down Expand Up @@ -47,9 +49,9 @@ struct BeanDetailView: View {
Spacer()
Button(action: {showEditView.toggle()}) {
Image(systemName: SFSymbols.pencil)
}
}.foregroundColor(colorScheme == .dark ? .white : .accentColor)
}.padding()
.background(.thinMaterial)
.background(.thickMaterial)
.cornerRadius(10, corners: [.bottomLeft, .bottomRight])
.sheet(isPresented: $showEditView) {
showEditView = false
Expand All @@ -67,10 +69,10 @@ struct BeanDetailView: View {
}
}

//struct BeanDetailView_Previews: PreviewProvider {
// static var previews: some View {
// NavigationView {
// BeanDetailView(bean: testRoast)
// }
// }
//}
struct BeanDetailView_Previews: PreviewProvider {
static var previews: some View {
NavigationView {
BeanDetailView(bean: testRoast)
}
}
}
35 changes: 29 additions & 6 deletions CoffeeTracker/CoffeeTracker/Beans/BeanRowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import Foundation
import SwiftUI

struct BeanRowView: View {
@Environment(\.colorScheme) private var colorScheme

@State private var showingDetails = false

var bean: BeanModel
Expand All @@ -28,6 +30,7 @@ struct BeanRowView: View {
Image(uiImage: bean.image)
.resizable()
.aspectRatio(contentMode: .fit)
.cornerRadius(10)
.frame(width: 100, height: 100, alignment: .center)
VStack(alignment: .leading, spacing: 5) {
HStack(alignment: .top) {
Expand All @@ -48,24 +51,44 @@ struct BeanRowView: View {
.font(.footnote)
}
}
.padding(.horizontal)
.foregroundColor(colorScheme == .dark ? .black : .primary)
.padding(.leading, 10)
.padding(.trailing)
if showingDetails {
BeanDetailView(bean: bean)
.foregroundColor(colorScheme == .dark ? .black : .primary)
}

}.padding(.top, 10)
.padding(.bottom, showingDetails ? 0 : 10)
.background(Color.bone)
}.padding(.top, 0)
.padding(.bottom, 0)
.background(colorScheme == .dark ? .primary : .secondary)
.background(.thinMaterial)
.cornerRadius(10)
.overlay(
RoundedRectangle(cornerRadius: 10)
.stroke(.tertiary, lineWidth: 0.5)
)
.shadow(radius: 2)
.gesture(tap)
// .animation(.default, value: showingDetails)
}
}

struct BeanRowView_Previews: PreviewProvider {
static var previews: some View {
VStack {
BeanRowView(bean: testRoast)
ZStack {
Image("Background")
.resizable()
.ignoresSafeArea()
ScrollView {
BeanRowView(bean: testRoast)
.padding(.vertical, 5)
.padding(.horizontal)
BeanRowView(bean: testRoast)
.padding(.vertical, 5)
.padding(.horizontal)
}
}
.preferredColorScheme(.dark)
}
}
42 changes: 36 additions & 6 deletions CoffeeTracker/CoffeeTracker/Beans/BeansCollectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,61 @@
import SwiftUI

struct BeansCollectionView: View {
@Environment(\.colorScheme) private var colorScheme
@Environment(\.managedObjectContext) private var viewContext
@EnvironmentObject var beansOO: BeansCollectionViewOO

@State private var search: String = ""

var body: some View {
VStack(alignment: .leading) {
Text("Beans")
.font(.largeTitle)
.padding()
ZStack(alignment: .top) {
ScrollView {
HStack {
Spacer()
.frame(height: 100)
}
#if DEBUG
ForEach([testRoast, lightRoast, mediumRoast], id: \.self) { bean in
BeanRowView(bean: bean)
.padding(.vertical, 5)
.padding(.horizontal)
}
#else
ForEach(beansOO.beans, id: \.self) { bean in
BeanRowView(bean: bean)
.padding()
.padding(.vertical, 5)
.padding(.horizontal)
}
#endif
}
Group {
GeometryReader { geometry in
HStack(alignment: .bottom) {
Text("Beans")
.font(.largeTitle)
.bold()
.padding(.top, 10)
.padding(.leading)
Spacer()
}
.frame(height: geometry.safeAreaInsets.top+80)
.background(.ultraThinMaterial)
.cornerRadius(10, corners: .bottomLeft)
.cornerRadius(10, corners: .bottomRight)
.edgesIgnoringSafeArea(.top)
}
}.shadow(radius: 2)
}
}
}

struct BeansCollectionView_Previews: PreviewProvider {
static var previews: some View {
BeansCollectionView()
ZStack {
Image("Background")
.resizable()
.ignoresSafeArea()
BeansCollectionView()
}.preferredColorScheme(.dark)
}
}
2 changes: 1 addition & 1 deletion CoffeeTracker/CoffeeTracker/Beans/NewBeansView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ struct NewBeansView: View {

}.padding()
Spacer()
}.background(.ultraThickMaterial).sheet(isPresented: $showingPhotoPicker) {
}.background(.thinMaterial).sheet(isPresented: $showingPhotoPicker) {
ImagePicker(selectedImage: $beans.image, isImageSelected: $isImageSelected)
}
}
Expand Down
9 changes: 8 additions & 1 deletion CoffeeTracker/CoffeeTracker/CoffeeTrackerMain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,22 @@ struct CoffeeTrackerMain: View {

var body: some View {
ZStack(alignment: .bottomTrailing) {
Image("Background")
.resizable()
.ignoresSafeArea()
BeansCollectionView()
if showButtons {
NewBeansView(showForm: $showButtons)
.opacity(showButtons ? 1 : 0)
}
Button(action: {showButtons.toggle()}) {
Image(systemName: SFSymbols.plus)
.font(.largeTitle)
.background(Circle()
.fill(showButtons ? Color.red : Color.sage)
.frame(width: 60, height: 60))
.padding(12)
.background(Circle().fill(showButtons ? Color.red : Color.sage)).shadow(radius: 8, x: 4, y: 4)
.shadow(radius: 8, x: 4, y: 4)
.rotationEffect(Angle.degrees(showButtons ? 45 : 0))
}.padding(20)
.tint(.white)
Expand Down
9 changes: 6 additions & 3 deletions CoffeeTracker/CoffeeTracker/Fixtures/BeanFixtures.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,25 @@ var lightRoast = BeanModel(name: "Verona Blend",
roaster: "Starbucks",
roastedOn: Date.now,
boughtOn: Date.now,
notes: "", image: UIImage())
notes: "",
image: UIImage(systemName: SFSymbols.photo)!)

var mediumRoast = BeanModel(name: "20th Anniversary Blend",
style: "Medium",
buyAgain: false,
roaster: "Summermoon",
roastedOn: Date.now,
boughtOn: Date.now,
notes: "I like it a lot", image: UIImage())
notes: "I like it a lot",
image: UIImage(systemName: SFSymbols.photo)!)

var testRoast = BeanModel(name: "Swiftly Brewed",
style: "Light",
buyAgain: true,
roaster: "Apple Inc",
roastedOn: Date.now,
boughtOn: Date.now,
notes: "Sold in Maegan's hopes and dreams", image: UIImage())
notes: "Sold in Maegan's hopes and dreams",
image: UIImage(systemName: SFSymbols.photo)!)

let allRoasts = [lightRoast, mediumRoast, testRoast]
Binary file added design-assets/background.afdesign
Binary file not shown.
Binary file added design-assets/background/dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added design-assets/background/dark@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added design-assets/background/dark@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added design-assets/background/light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added design-assets/background/light@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added design-assets/background/light@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.