Skip to content
Open
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
20 changes: 20 additions & 0 deletions RepeatCooking.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
1186603725FAD70900A32B3A /* Data+Image.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1186603625FAD70900A32B3A /* Data+Image.swift */; };
1186604E25FE9FE400A32B3A /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1186604D25FE9FE300A32B3A /* Color.swift */; };
1186606325FEE76600A32B3A /* RepeatCooking.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 1186606125FEE76600A32B3A /* RepeatCooking.xcdatamodeld */; };
11A9F42B268F396E00FA1CB0 /* Font.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11A9F42A268F396E00FA1CB0 /* Font.swift */; };
11A9F42D268F39CC00FA1CB0 /* Padding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11A9F42C268F39CC00FA1CB0 /* Padding.swift */; };
11A9F430268F3AEF00FA1CB0 /* Hidden.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11A9F42F268F3AEF00FA1CB0 /* Hidden.swift */; };
11B4CC9625F7C0CA000843FB /* AVFoundationVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B4CC9525F7C0CA000843FB /* AVFoundationVM.swift */; };
11B4CCC725F7D07E000843FB /* CameraView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B4CCC625F7D07E000843FB /* CameraView.swift */; };
11B4CCCD25F7EC94000843FB /* UIApplication.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B4CCCC25F7EC94000843FB /* UIApplication.swift */; };
Expand Down Expand Up @@ -79,6 +82,9 @@
1186603625FAD70900A32B3A /* Data+Image.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Data+Image.swift"; sourceTree = "<group>"; };
1186604D25FE9FE300A32B3A /* Color.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Color.swift; sourceTree = "<group>"; };
1186606225FEE76600A32B3A /* RepeatCooking.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = RepeatCooking.xcdatamodel; sourceTree = "<group>"; };
11A9F42A268F396E00FA1CB0 /* Font.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Font.swift; sourceTree = "<group>"; };
11A9F42C268F39CC00FA1CB0 /* Padding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Padding.swift; sourceTree = "<group>"; };
11A9F42F268F3AEF00FA1CB0 /* Hidden.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Hidden.swift; sourceTree = "<group>"; };
11B4CC9525F7C0CA000843FB /* AVFoundationVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AVFoundationVM.swift; sourceTree = "<group>"; };
11B4CCC625F7D07E000843FB /* CameraView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraView.swift; sourceTree = "<group>"; };
11B4CCCC25F7EC94000843FB /* UIApplication.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIApplication.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -139,6 +145,7 @@
1108334E25F0169600903FE3 /* RepeatCooking */ = {
isa = PBXGroup;
children = (
11A9F42E268F3AD300FA1CB0 /* Modifier */,
110965AC2609BE880059C6A7 /* Fonts */,
1186606025FEE73E00A32B3A /* DB */,
11B4CCED25F9D2FC000843FB /* Model */,
Expand Down Expand Up @@ -219,6 +226,14 @@
path = Components;
sourceTree = "<group>";
};
11A9F42E268F3AD300FA1CB0 /* Modifier */ = {
isa = PBXGroup;
children = (
11A9F42F268F3AEF00FA1CB0 /* Hidden.swift */,
);
path = Modifier;
sourceTree = "<group>";
};
11B4CCCB25F7EC70000843FB /* Extensions */ = {
isa = PBXGroup;
children = (
Expand All @@ -228,6 +243,8 @@
1186603625FAD70900A32B3A /* Data+Image.swift */,
1186604D25FE9FE300A32B3A /* Color.swift */,
110965A72609B4C50059C6A7 /* TextFont.swift */,
11A9F42A268F396E00FA1CB0 /* Font.swift */,
11A9F42C268F39CC00FA1CB0 /* Padding.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -439,15 +456,18 @@
11B4CC9625F7C0CA000843FB /* AVFoundationVM.swift in Sources */,
1108335025F0169600903FE3 /* AppDelegate.swift in Sources */,
11865FEC25FAB4E600A32B3A /* HomeViewItem.swift in Sources */,
11A9F42D268F39CC00FA1CB0 /* Padding.swift in Sources */,
1186606325FEE76600A32B3A /* RepeatCooking.xcdatamodeld in Sources */,
1186603725FAD70900A32B3A /* Data+Image.swift in Sources */,
11F3B30525F4466C00CE638F /* TextView.swift in Sources */,
11B4CCC725F7D07E000843FB /* CameraView.swift in Sources */,
1185038F25F3CE05004A31A3 /* EditStore.swift in Sources */,
11B4CCE925F9D247000843FB /* HomeView.swift in Sources */,
110965A82609B4C50059C6A7 /* TextFont.swift in Sources */,
11A9F430268F3AEF00FA1CB0 /* Hidden.swift in Sources */,
115DA841260D9C88001E50EF /* LongTouchGestureView.swift in Sources */,
1186603225FAD57A00A32B3A /* CookItem.swift in Sources */,
11A9F42B268F396E00FA1CB0 /* Font.swift in Sources */,
1108335225F0169600903FE3 /* SceneDelegate.swift in Sources */,
11B4CCEF25F9D30C000843FB /* Model.swift in Sources */,
1186604E25FE9FE400A32B3A /* Color.swift in Sources */,
Expand Down
Binary file not shown.
9 changes: 1 addition & 8 deletions RepeatCooking/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let container = NSPersistentContainer(name: "RepeatCooking")
container.loadPersistentStores(completionHandler: { (_, error) in
if let error = error as NSError? {
print(error.localizedDescription)
fatalError(error.localizedDescription)
}
})
return container
Expand All @@ -36,11 +36,4 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
return true
}

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
}
}
3 changes: 1 addition & 2 deletions RepeatCooking/Components/Camera/CameraView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ struct CameraView: View {
HStack {
Button(action: {
self.isActive.toggle()
}) {
Text("キャンセル")
}) { Text("キャンセル")
}
.frame(width: 80, height: 80, alignment: .leading)
Spacer()
Expand Down
2 changes: 1 addition & 1 deletion RepeatCooking/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import SwiftUI

struct ContentView: View {
var body: some View {
HomeView()
HomeView(action: { print("tap") })
}
}

Expand Down
3 changes: 1 addition & 2 deletions RepeatCooking/Extensions/Color.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
// RepeatCooking
//
// Created by tiking on 2021/03/15.
//

import Foundation
import SwiftUI

extension UIColor {
static let lightOrange = UIColor(red: 255/255, green: 249/255, blue: 249/255, alpha: 1)
}

// test color
enum ColorAssets {
case lightOrange
var name: String {
Expand Down
7 changes: 0 additions & 7 deletions RepeatCooking/Extensions/Data+Image.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
//
// Data+Image.swift
// RepeatCooking
//
// Created by tiking on 2021/03/12.
//

import Foundation
import UIKit

Expand Down
7 changes: 0 additions & 7 deletions RepeatCooking/Extensions/Date.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
//
// Date.swift
// RepeatCooking
//
// Created by tiking on 2021/03/11.
//

import Foundation

private var formatter: DateFormatter {
Expand Down
38 changes: 38 additions & 0 deletions RepeatCooking/Extensions/Font.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import SwiftUI

extension Font {

/// 24px, Bold
static let h1 = Font.system(size: 24, weight: .semibold)

/// 22px, Bold
static let h2 = Font.system(size: 22, weight: .semibold)

/// 18px, Bold
static let h3 = Font.system(size: 18, weight: .semibold)

/// 16px, Bold
static let h4 = Font.system(size: 16, weight: .semibold)

/// 16px
static let body = Font.system(size: 16)

/// 15px
static let subtitle = Font.system(size: 15)

/// 14px
static let body2 = Font.system(size: 14)

/// 13px
static let subtitle2 = Font.system(size: 13)

/// 12px
static let caption = Font.system(size: 12)

/// 10px
static let caption2 = Font.system(size: 10)

// 15px, Bold
static let button = Font.system(size: 15, weight: .semibold)
}

5 changes: 0 additions & 5 deletions RepeatCooking/Extensions/Keyboard.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
//
// Keyboard.swift
// RepeatCooking
//
// Created by tiking on 2021/03/11.
//

import Combine
import SwiftUI

Expand Down
55 changes: 55 additions & 0 deletions RepeatCooking/Extensions/Padding.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import SwiftUI

enum Padding {
/// 32px
static let XXL: CGFloat = 32

/// 24px
static let XL: CGFloat = 24

/// 16px
static let L: CGFloat = 16

/// 12px
static let M: CGFloat = 12

/// 8px
static let S: CGFloat = 8

/// 4px
static let XS: CGFloat = 4

/// 0ox
static let Zero: CGFloat = 0
}

enum ButtonSize {
case slim, medium, large
}

extension Padding {
static func buttonEdgeInsets(from size: ButtonSize) -> EdgeInsets {
var horizontal: CGFloat {
switch size {
case .slim:
return 12
case .medium:
return 16
case .large:
return 20
}
}
var vertical: CGFloat {
switch size {
case .slim:
return 8
case .medium:
return 12
case .large:
return 16
}
}
return EdgeInsets(top: vertical, leading: horizontal, bottom: vertical, trailing: horizontal)
}
}

7 changes: 0 additions & 7 deletions RepeatCooking/Extensions/TextFont.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
//
// TextFont.swift
// RepeatCooking
//
// Created by tiking on 2021/03/23.
//

import SwiftUI

extension Text {
Expand Down
8 changes: 1 addition & 7 deletions RepeatCooking/Extensions/UIApplication.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
//
// UIApplication.swift
// RepeatCooking
//
// Created by tiking on 2021/03/10.
//

import SwiftUI

extension UIApplication {
func closeKeyboard() {
sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
Expand Down
12 changes: 3 additions & 9 deletions RepeatCooking/Home/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ struct HomeView: View {
@State var flag = false
@State var isRemove = false
@StateObject private var model = SendModelRequest()
let action: () -> Void

var body: some View {
ZStack {
Expand Down Expand Up @@ -44,10 +45,9 @@ struct HomeView: View {
}
Spacer()
ScrollView {
ForEach(cookItems) {
item in
ForEach(cookItems) { item in
ZStack {
Button(action: {}) {
Button(action: action) {
HomeViewItem(image: item.image.toImage(), dateString: item.cookedAt, text2: item.text, callback: { print("completed") }
)
}
Expand Down Expand Up @@ -80,9 +80,3 @@ struct HomeView: View {
}
}
}

struct StoreView_Previews: PreviewProvider {
static var previews: some View {
HomeView()
}
}
6 changes: 0 additions & 6 deletions RepeatCooking/Home/HomeViewItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,3 @@ struct HomeViewItem: View {
.padding(EdgeInsets(top: 10, leading: 10, bottom: 10, trailing: 10))
}
}

struct HomeViewItem_Previews: PreviewProvider {
static var previews: some View {
HomeViewItem(image: UIImage(imageLiteralResourceName: "Camera"), dateString: Date().string, text2: "クッキー", callback: { print("test") })
}
}
11 changes: 11 additions & 0 deletions RepeatCooking/Modifier/Hidden.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import SwiftUI

extension View {
@ViewBuilder func isHidden(_ isHidden: Bool) -> some View {
if isHidden {
hidden()
} else {
self
}
}
}