Adding SwiftUI Ingredient List - #21
alexking124 wants to merge 9 commits into
Conversation
| if (isnan(newContentOffset.y)) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
I had some weird crashes that I needed to fix with this. 🤷♂ Should be fine once this is converted to Swift
| }, label: { | ||
| Image(systemName: "xmark") | ||
| .foregroundColor(SwiftUI.Color(Color.cakeRed)) | ||
| .font(Font.system(size: 20, weight: .medium, design: .default)) |
There was a problem hiding this comment.
Wait, why is there font in here at all? This is the closing X thing, right?
| // CSIngredientListVC* ingrListVC = [[CSIngredientListVC alloc] initWithDelegate:self]; | ||
| // UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:ingrListVC]; | ||
| // [self presentViewController:nav animated:YES completion:nil]; |
There was a problem hiding this comment.
Clean up the comments.
| } | ||
|
|
||
| extension CSIngredients { | ||
| var ingredientList: [CSIngredientGroup] { |
There was a problem hiding this comment.
Minor: I would name it all or ingredientGroups, because ingredientList kinda looks like [CSIngredient].
| static inline CGFloat ptsPerUnit(CSScaleView *scaleView) | ||
| { | ||
| return (SCALE_TILE_HEIGHT/scaleView.unitsPerTile); | ||
| CGFloat pts = (SCALE_TILE_HEIGHT/scaleView.unitsPerTile); |
There was a problem hiding this comment.
Hmmm... that sounds like we have some kind of a problem with the view lifecycle. It sounds like this is being called when unitsPerTile is zero?
| if (isnan(newContentOffset.y)) { | ||
| return; | ||
| } |
| scaleView.delegate = nil; | ||
| if (cancelDeceleration) | ||
| { | ||
| NSLog(@"%f", newContentOffset.y); |
| NavigationLink(destination: CSEditIngredientVCRepresentable(), | ||
| label: { Image(systemName: "plus") | ||
| .foregroundColor(SwiftUI.Color(Color.cakeRed)) | ||
| .font(Font.system(size: 20, weight: .medium, design: .default)) |
There was a problem hiding this comment.
Same here. Why do we need a font here at all?
| }, label: { | ||
| Image(systemName: "pencil.circle") | ||
| .foregroundColor(SwiftUI.Color(Color.cakeRed)) | ||
| .font(Font.system(size: 22, weight: .regular, design: .default)) |
There was a problem hiding this comment.
Same question regarding font.
| .navigationBarTitle("Ingredients") | ||
| .navigationBarItems(leading: | ||
| Button(action: { | ||
| print("Pressed") |
There was a problem hiding this comment.
Need to fill in the action here.
| Text(ingredientName) | ||
| Spacer() | ||
| Button(action: { | ||
| print("Edit Tapped") |
There was a problem hiding this comment.
Need to fill in action here.
| label: { Image(systemName: "plus") | ||
| .foregroundColor(SwiftUI.Color(Color.cakeRed)) | ||
| .font(Font.system(size: 20, weight: .medium, design: .default)) | ||
| })) |
There was a problem hiding this comment.
Aren't we missing the "Reset to Defaults" button here somewhere?
Most of the functionality is broken, but it shows the list of ingredients.