└── JournalCoreDataSwiftUI
├── JournalCoreDataSwiftUI
├── Assets.xcassets
│ ├── Contents.json
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Preview Content
│ └── Preview Assets.xcassets
│ │ └── Contents.json
├── Model
│ ├── Entry+Convenience.swift
│ └── JournalCoreDataSwiftUI.xcdatamodeld
│ │ └── JournalCoreDataSwiftUI.xcdatamodel
│ │ └── contents
├── CoreDataStack.swift
├── Views
│ ├── RowView.swift
│ ├── ContentView.swift
│ ├── AddEntryView.swift
│ ├── EditView.swift
│ └── DetailView.swift
├── AppDelegate.swift
├── MultiLineTextField.swift
├── Base.lproj
│ └── LaunchScreen.storyboard
├── Info.plist
├── Model Controller
│ └── EntryController.swift
└── SceneDelegate.swift
└── JournalCoreDataSwiftUI.xcodeproj
├── project.xcworkspace
├── contents.xcworkspacedata
├── xcuserdata
│ └── nelsongonzalez.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── UserInterfaceState.xcuserstate
└── xcshareddata
│ └── IDEWorkspaceChecks.plist
├── xcuserdata
└── nelsongonzalez.xcuserdatad
│ └── xcschemes
│ └── xcschememanagement.plist
└── project.pbxproj
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI/Preview Content/Preview Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI.xcodeproj/project.xcworkspace/xcuserdata/nelsongonzalez.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI.xcodeproj/project.xcworkspace/xcuserdata/nelsongonzalez.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nelglez/Journal-CoreData-SwiftUI/HEAD/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI.xcodeproj/project.xcworkspace/xcuserdata/nelsongonzalez.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI.xcodeproj/xcuserdata/nelsongonzalez.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | JournalCoreDataSwiftUI.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI/Model/Entry+Convenience.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Entry+Convenience.swift
3 | // JournalCoreDataSwiftUI
4 | //
5 | // Created by Nelson Gonzalez on 12/10/19.
6 | // Copyright © 2019 Nelson Gonzalez. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import CoreData
11 |
12 | extension Entry {
13 |
14 | @discardableResult convenience init(title: String, timeStamp: Date = Date(), id: UUID = UUID(), entryDescription: String, context: NSManagedObjectContext = CoreDataStack.shared.mainContext) {
15 |
16 | self.init(context: context)
17 |
18 | self.id = id
19 | self.title = title
20 | self.timeStamp = timeStamp
21 | self.entryDescription = entryDescription
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI/Model/JournalCoreDataSwiftUI.xcdatamodeld/JournalCoreDataSwiftUI.xcdatamodel/contents:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI/CoreDataStack.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CoreDataStack.swift
3 | // JournalCoreDataSwiftUI
4 | //
5 | // Created by Nelson Gonzalez on 12/10/19.
6 | // Copyright © 2019 Nelson Gonzalez. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import CoreData
11 |
12 |
13 | class CoreDataStack {
14 |
15 | // shared property pattern
16 | // Let us access the CoreDataStack from anywhere inthe app
17 | static let shared = CoreDataStack()
18 |
19 | // Setup a persistent container
20 |
21 | lazy var container: NSPersistentContainer = {
22 |
23 | let container = NSPersistentContainer(name: "JournalCoreDataSwiftUI") // Name of the data model file
24 | // creates a persistent store
25 | container.loadPersistentStores { (_, error) in
26 | // Check for an error and intentionally crash the app with fatalError if there is an error
27 | if let error = error {
28 | fatalError("Failed to load persistent stores: \(error)")
29 | }
30 | }
31 | // Return the container
32 | return container
33 | }()
34 |
35 |
36 | // Create easy acces to the ManagedObjectContext (moc)
37 | // Create a computed property
38 | var mainContext: NSManagedObjectContext {
39 | return container.viewContext
40 | }
41 | }
42 |
43 |
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI/Views/RowView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // RowView.swift
3 | // JournalCoreDataSwiftUI
4 | //
5 | // Created by Nelson Gonzalez on 12/11/19.
6 | // Copyright © 2019 Nelson Gonzalez. All rights reserved.
7 | //
8 |
9 | import SwiftUI
10 |
11 | struct RowView: View {
12 |
13 | @ObservedObject var entry: Entry
14 |
15 | var timeFormatter: String {
16 | let formatter = DateFormatter()
17 | formatter.dateFormat = "MM-dd-yyyy HH:mm"
18 | formatter.dateStyle = .short
19 | formatter.timeStyle = .short
20 | let dateString = formatter.string(from: entry.timeStamp ?? Date())
21 |
22 | let returnString = "\(dateString)"
23 | return returnString
24 | }
25 |
26 |
27 | var body: some View {
28 | ZStack {
29 | Rectangle().fill(Color.white).frame(width: UIScreen.main.bounds.width - 32, height: 100).cornerRadius(10).shadow(color: .gray, radius: 4)
30 | VStack(alignment: .leading) {
31 | HStack {
32 | Text(entry.title ?? "There is no title")
33 | Spacer()
34 | Text(timeFormatter)
35 |
36 | }.padding(.bottom)
37 | Text(entry.entryDescription ?? "No description").font(.title)
38 | }.padding()
39 |
40 | }
41 |
42 | }
43 | }
44 |
45 | struct RowView_Previews: PreviewProvider {
46 | static var previews: some View {
47 | RowView(entry: Entry(title: "Test", entryDescription: "This is a test"))
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI/Views/ContentView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ContentView.swift
3 | // JournalCoreDataSwiftUI
4 | //
5 | // Created by Nelson Gonzalez on 12/10/19.
6 | // Copyright © 2019 Nelson Gonzalez. All rights reserved.
7 | //
8 |
9 | import SwiftUI
10 |
11 | struct ContentView: View {
12 | // @Environment(\.managedObjectContext) var moc
13 | // @FetchRequest(entity: Entry.entity(), sortDescriptors: []) var entries: FetchedResults
14 | @ObservedObject var entryController = EntryController()
15 | @State private var showing: Bool = false
16 |
17 |
18 | var body: some View {
19 | NavigationView {
20 | List {
21 | ForEach(entryController.entries, id: \.id) { entry in
22 | NavigationLink(destination: DetailView(entryController: self.entryController, entry: entry)) {
23 | RowView(entry: entry)
24 | }
25 | }.onDelete(perform: self.entryController.deleteEntry)
26 |
27 | }.navigationBarTitle("Journal Entries").navigationBarItems(trailing: Button(action: {
28 | self.showing = true
29 | }, label: {
30 | Image(systemName: "plus.circle").font(.largeTitle).foregroundColor(.green)
31 | }).sheet(isPresented: $showing, content: {
32 | AddEntryView(entryController: self.entryController)
33 | }))
34 | }
35 | }
36 | }
37 |
38 | struct ContentView_Previews: PreviewProvider {
39 | static var previews: some View {
40 | ContentView()
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // JournalCoreDataSwiftUI
4 | //
5 | // Created by Nelson Gonzalez on 12/10/19.
6 | // Copyright © 2019 Nelson Gonzalez. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 |
15 |
16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
17 | // Override point for customization after application launch.
18 | return true
19 | }
20 |
21 | // MARK: UISceneSession Lifecycle
22 |
23 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
24 | // Called when a new scene session is being created.
25 | // Use this method to select a configuration to create the new scene with.
26 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
27 | }
28 |
29 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) {
30 | // Called when the user discards a scene session.
31 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
32 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
33 | }
34 |
35 |
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI/MultiLineTextField.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MultiLineTextField.swift
3 | // JournalCoreDataSwiftUI
4 | //
5 | // Created by Nelson Gonzalez on 12/12/19.
6 | // Copyright © 2019 Nelson Gonzalez. All rights reserved.
7 | //
8 |
9 | import SwiftUI
10 |
11 | struct MultiLineTextField: UIViewRepresentable {
12 |
13 | @Binding var txt: String
14 |
15 | func makeCoordinator() -> MultiLineTextField.Coordinator {
16 |
17 | return MultiLineTextField.Coordinator(parent1: self)
18 | }
19 | func makeUIView(context: Context) -> UITextView {
20 |
21 | let text = UITextView()
22 | text.isEditable = true
23 | text.isUserInteractionEnabled = true
24 | text.text = txt//"Type Something"
25 | text.textColor = .gray
26 | text.backgroundColor = UIColor(red: 239/255, green: 243/255, blue: 244/255, alpha: 1)
27 | text.font = .systemFont(ofSize: 20)
28 | text.delegate = context.coordinator
29 |
30 | return text
31 | }
32 |
33 | func updateUIView(_ uiView: UITextView, context: Context) {
34 |
35 |
36 | }
37 |
38 | class Coordinator: NSObject, UITextViewDelegate {
39 |
40 |
41 | var parent: MultiLineTextField
42 |
43 | init(parent1: MultiLineTextField) {
44 |
45 | parent = parent1
46 | }
47 |
48 | func textViewDidBeginEditing(_ textView: UITextView) {
49 |
50 | // textView.text = ""
51 | textView.textColor = .black
52 | }
53 |
54 | func textViewDidChange(_ textView: UITextView) {
55 |
56 | self.parent.txt = textView.text
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "20x20",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "20x20",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "29x29",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "29x29",
61 | "scale" : "2x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "40x40",
66 | "scale" : "1x"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "size" : "40x40",
71 | "scale" : "2x"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "size" : "76x76",
76 | "scale" : "1x"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "size" : "76x76",
81 | "scale" : "2x"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "size" : "83.5x83.5",
86 | "scale" : "2x"
87 | },
88 | {
89 | "idiom" : "ios-marketing",
90 | "size" : "1024x1024",
91 | "scale" : "1x"
92 | }
93 | ],
94 | "info" : {
95 | "version" : 1,
96 | "author" : "xcode"
97 | }
98 | }
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UIApplicationSceneManifest
24 |
25 | UIApplicationSupportsMultipleScenes
26 |
27 | UISceneConfigurations
28 |
29 | UIWindowSceneSessionRoleApplication
30 |
31 |
32 | UISceneConfigurationName
33 | Default Configuration
34 | UISceneDelegateClassName
35 | $(PRODUCT_MODULE_NAME).SceneDelegate
36 |
37 |
38 |
39 |
40 | UILaunchStoryboardName
41 | LaunchScreen
42 | UIRequiredDeviceCapabilities
43 |
44 | armv7
45 |
46 | UISupportedInterfaceOrientations
47 |
48 | UIInterfaceOrientationPortrait
49 | UIInterfaceOrientationLandscapeLeft
50 | UIInterfaceOrientationLandscapeRight
51 |
52 | UISupportedInterfaceOrientations~ipad
53 |
54 | UIInterfaceOrientationPortrait
55 | UIInterfaceOrientationPortraitUpsideDown
56 | UIInterfaceOrientationLandscapeLeft
57 | UIInterfaceOrientationLandscapeRight
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI/Model Controller/EntryController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // EntryController.swift
3 | // JournalCoreDataSwiftUI
4 | //
5 | // Created by Nelson Gonzalez on 12/10/19.
6 | // Copyright © 2019 Nelson Gonzalez. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import CoreData
11 | import Combine
12 |
13 | class EntryController: ObservableObject {
14 |
15 | // MARK: - Properties
16 | // all computed properties have to return something!
17 | @Published var entries: [Entry] = []
18 |
19 | init() {
20 | getEntries()
21 | }
22 |
23 |
24 | func saveToPersistentStore() {
25 | let moc = CoreDataStack.shared.mainContext
26 | do {
27 | try moc.save()
28 | getEntries()
29 |
30 | } catch {
31 | NSLog("Error saving managed object context: \(error)")
32 | }
33 | }
34 |
35 | func getEntries() {
36 | let fetchRequest: NSFetchRequest = Entry.fetchRequest()
37 | let moc = CoreDataStack.shared.mainContext
38 |
39 | do {
40 | entries = try moc.fetch(fetchRequest)
41 |
42 | } catch {
43 | NSLog("Error fetching tasks: \(error)")
44 |
45 | }
46 | }
47 |
48 | // MARK: - CRUD Methods
49 |
50 | // Create
51 | func createEntry(title: String, entryDescription: String) {
52 | _ = Entry(title: title, entryDescription: entryDescription)
53 | saveToPersistentStore()
54 | }
55 |
56 | // Read
57 |
58 | // Update
59 | func updateEntry(entry: Entry, title: String, entryDescription: String) {
60 | entry.title = title
61 | entry.entryDescription = entryDescription
62 |
63 | saveToPersistentStore()
64 | }
65 |
66 | // Delete
67 | func deleteEntry(entry: Entry) {
68 | let mainC = CoreDataStack.shared.mainContext
69 | mainC.delete(entry)
70 | saveToPersistentStore() }
71 |
72 | func deleteEntry(at indexSet: IndexSet) {
73 | guard let index = Array(indexSet).first else { return }
74 |
75 | let entry = self.entries[index]
76 |
77 | deleteEntry(entry: entry)
78 |
79 | }
80 |
81 |
82 | }
83 |
84 |
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI/Views/AddEntryView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AddEntryView.swift
3 | // JournalCoreDataSwiftUI
4 | //
5 | // Created by Nelson Gonzalez on 12/11/19.
6 | // Copyright © 2019 Nelson Gonzalez. All rights reserved.
7 | //
8 |
9 | import SwiftUI
10 |
11 | struct AddEntryView: View {
12 | @ObservedObject var entryController: EntryController
13 | @State private var title = ""
14 | @State private var description = ""
15 | @Environment(\.presentationMode) var presentationMode
16 | @State private var isShowingAlert = false
17 |
18 |
19 | var body: some View {
20 | NavigationView {
21 | Form {
22 | VStack {
23 | TextField("Entry title...", text: $title).padding().background(Color(red: 239/255, green: 243/255, blue: 244/255))//.textFieldStyle(RoundedBorderTextFieldStyle())
24 | TextField("Entry description...", text: $description).padding().background(Color(red: 239/255, green: 243/255, blue: 244/255))
25 | Button(action: {
26 | if !self.title.isEmpty && !self.description.isEmpty {
27 | self.entryController.createEntry(title: self.title, entryDescription: self.description)
28 | self.title = ""
29 | self.description = ""
30 |
31 | self.presentationMode.wrappedValue.dismiss()
32 | } else {
33 | self.isShowingAlert = true
34 | }
35 |
36 | }) {
37 | Text("Add Entry")
38 | }.padding().background(Color.green).clipShape(RoundedRectangle(cornerRadius: 10)).foregroundColor(.white).shadow(color: Color.gray, radius: 5)
39 | Spacer()
40 | }.padding().navigationBarTitle("Add Entry", displayMode: .inline).alert(isPresented: $isShowingAlert) {
41 | Alert(title: Text("Warning"), message: Text("Please make sure both the title and the description aren't empty!"), dismissButton: .default(Text("OK!")))
42 | }
43 | }
44 | }
45 | }
46 | }
47 |
48 | struct AddEntryView_Previews: PreviewProvider {
49 | static var previews: some View {
50 | AddEntryView(entryController: EntryController())
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI/Views/EditView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // EditView.swift
3 | // JournalCoreDataSwiftUI
4 | //
5 | // Created by Nelson Gonzalez on 12/11/19.
6 | // Copyright © 2019 Nelson Gonzalez. All rights reserved.
7 | //
8 |
9 | import SwiftUI
10 |
11 | struct EditView: View {
12 | @ObservedObject var entryController: EntryController
13 | @State var entry: Entry
14 | @State private var title = ""
15 | @Binding var description: String
16 | @State private var isShowingAlert = false
17 | @Environment(\.presentationMode) var presentationMode
18 |
19 | var body: some View {
20 | NavigationView {
21 |
22 | VStack {
23 | TextField("\(entry.title ?? "No title.")", text: $title).padding().background(Color(red: 239/255, green: 243/255, blue: 244/255))//.textFieldStyle(RoundedBorderTextFieldStyle())
24 |
25 | MultiLineTextField(txt: $description).frame(height: 200).padding(.bottom)
26 |
27 | Button(action: {
28 | if !self.title.isEmpty && !self.description.isEmpty {
29 | self.entryController.updateEntry(entry: self.entry, title: self.title, entryDescription: self.description)
30 |
31 | self.presentationMode.wrappedValue.dismiss()
32 | } else {
33 | self.isShowingAlert = true
34 | }
35 | }) {
36 | Text("Save")
37 | }.frame(width: 90).padding().background(Color.green).clipShape(RoundedRectangle(cornerRadius: 10)).foregroundColor(.white).shadow(color: Color.gray, radius: 5)
38 | Spacer()
39 | }.onAppear {
40 | self.title = self.entry.title!
41 | self.description = self.entry.entryDescription!
42 | }.padding().navigationBarTitle("Edit entry", displayMode: .inline).alert(isPresented: $isShowingAlert) {
43 | Alert(title: Text("Warning"), message: Text("Please make sure both the title and the description aren't empty!"), dismissButton: .default(Text("OK!")))
44 | }
45 |
46 | }
47 | }
48 | }
49 |
50 | struct EditView_Previews: PreviewProvider {
51 | static var previews: some View {
52 | EditView(entryController: EntryController(), entry: Entry(title: "Test", entryDescription: "Testing..."), description: .constant("Testing..."))
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI/Views/DetailView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DetailView.swift
3 | // JournalCoreDataSwiftUI
4 | //
5 | // Created by Nelson Gonzalez on 12/11/19.
6 | // Copyright © 2019 Nelson Gonzalez. All rights reserved.
7 | //
8 |
9 | import SwiftUI
10 |
11 | struct DetailView: View {
12 | @ObservedObject var entryController: EntryController
13 | @State var entry: Entry
14 | @State var entryDescription = ""
15 |
16 | var timeFormatter: String {
17 | let formatter = DateFormatter()
18 | formatter.dateFormat = "MM-dd-yyyy HH:mm"
19 | formatter.dateStyle = .short
20 | formatter.timeStyle = .short
21 | let dateString = formatter.string(from: entry.timeStamp ?? Date())
22 |
23 | let returnString = "\(dateString)"
24 | return returnString
25 | }
26 |
27 | @State private var showing: Bool = false
28 |
29 | var body: some View {
30 | NavigationView {
31 |
32 | VStack {
33 | HStack {
34 | Text(entry.title ?? "There is no title")
35 | Spacer()
36 | Text(timeFormatter).font(.footnote)
37 |
38 | }.padding(.bottom)
39 | Text(entry.entryDescription ?? "No description").font(.title).padding()
40 |
41 |
42 | Button(action: {
43 | self.showing = true
44 | }) {
45 | Text("Edit")
46 | }.frame(width: 90).padding().background(Color.green).clipShape(RoundedRectangle(cornerRadius: 10)).foregroundColor(.white).shadow(color: Color.gray, radius: 5).sheet(isPresented: $showing) {
47 | EditView(entryController: self.entryController, entry: self.entry, description: self.$entryDescription)
48 |
49 | }
50 |
51 |
52 | Spacer()
53 | }.padding().background(Color(red: 239/255, green: 243/255, blue: 244/255)).onAppear {
54 | self.entryDescription = self.entry.entryDescription ?? ""
55 | }.navigationBarTitle(Text(entry.title ?? "There is no title."), displayMode: .inline)
56 |
57 | }
58 | }
59 | }
60 |
61 | struct DetailView_Previews: PreviewProvider {
62 | static var previews: some View {
63 | DetailView(entryController: EntryController(), entry: Entry(title: "Test", entryDescription: "Testing description"))
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI/SceneDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SceneDelegate.swift
3 | // JournalCoreDataSwiftUI
4 | //
5 | // Created by Nelson Gonzalez on 12/10/19.
6 | // Copyright © 2019 Nelson Gonzalez. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import SwiftUI
11 |
12 | class SceneDelegate: UIResponder, UIWindowSceneDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
18 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
19 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
20 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
21 |
22 | // Create the SwiftUI view that provides the window contents.
23 | let context = CoreDataStack.shared.container.viewContext
24 | let contentView = ContentView().environment(\.managedObjectContext, context)
25 |
26 | // Use a UIHostingController as window root view controller.
27 | if let windowScene = scene as? UIWindowScene {
28 | let window = UIWindow(windowScene: windowScene)
29 | window.rootViewController = UIHostingController(rootView: contentView)
30 | self.window = window
31 | window.makeKeyAndVisible()
32 | }
33 | }
34 |
35 | func sceneDidDisconnect(_ scene: UIScene) {
36 | // Called as the scene is being released by the system.
37 | // This occurs shortly after the scene enters the background, or when its session is discarded.
38 | // Release any resources associated with this scene that can be re-created the next time the scene connects.
39 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
40 | }
41 |
42 | func sceneDidBecomeActive(_ scene: UIScene) {
43 | // Called when the scene has moved from an inactive state to an active state.
44 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
45 | }
46 |
47 | func sceneWillResignActive(_ scene: UIScene) {
48 | // Called when the scene will move from an active state to an inactive state.
49 | // This may occur due to temporary interruptions (ex. an incoming phone call).
50 | }
51 |
52 | func sceneWillEnterForeground(_ scene: UIScene) {
53 | // Called as the scene transitions from the background to the foreground.
54 | // Use this method to undo the changes made on entering the background.
55 | }
56 |
57 | func sceneDidEnterBackground(_ scene: UIScene) {
58 | // Called as the scene transitions from the foreground to the background.
59 | // Use this method to save data, release shared resources, and store enough scene-specific state information
60 | // to restore the scene back to its current state.
61 | }
62 |
63 |
64 | }
65 |
66 |
--------------------------------------------------------------------------------
/JournalCoreDataSwiftUI/JournalCoreDataSwiftUI.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 50;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 7A538A55239FCCDE005B9E1E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A538A54239FCCDE005B9E1E /* AppDelegate.swift */; };
11 | 7A538A57239FCCDE005B9E1E /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A538A56239FCCDE005B9E1E /* SceneDelegate.swift */; };
12 | 7A538A59239FCCDE005B9E1E /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A538A58239FCCDE005B9E1E /* ContentView.swift */; };
13 | 7A538A5B239FCCE5005B9E1E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7A538A5A239FCCE5005B9E1E /* Assets.xcassets */; };
14 | 7A538A5E239FCCE5005B9E1E /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7A538A5D239FCCE5005B9E1E /* Preview Assets.xcassets */; };
15 | 7A538A61239FCCE5005B9E1E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7A538A5F239FCCE5005B9E1E /* LaunchScreen.storyboard */; };
16 | 7A538A6A239FCEBD005B9E1E /* JournalCoreDataSwiftUI.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 7A538A68239FCEBD005B9E1E /* JournalCoreDataSwiftUI.xcdatamodeld */; };
17 | 7A538A6C239FCF7E005B9E1E /* CoreDataStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A538A6B239FCF7E005B9E1E /* CoreDataStack.swift */; };
18 | 7A538A6E239FCFD3005B9E1E /* Entry+Convenience.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A538A6D239FCFD3005B9E1E /* Entry+Convenience.swift */; };
19 | 7A538A70239FD09C005B9E1E /* EntryController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A538A6F239FD09C005B9E1E /* EntryController.swift */; };
20 | 7A99CA5223A112A800BCD9BC /* RowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A99CA5123A112A800BCD9BC /* RowView.swift */; };
21 | 7A99CA5423A118DC00BCD9BC /* AddEntryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A99CA5323A118DC00BCD9BC /* AddEntryView.swift */; };
22 | 7A99CA5623A19AB300BCD9BC /* DetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A99CA5523A19AB200BCD9BC /* DetailView.swift */; };
23 | 7A99CA5823A19FB700BCD9BC /* EditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A99CA5723A19FB700BCD9BC /* EditView.swift */; };
24 | 7A99CA5A23A2704000BCD9BC /* MultiLineTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A99CA5923A2704000BCD9BC /* MultiLineTextField.swift */; };
25 | /* End PBXBuildFile section */
26 |
27 | /* Begin PBXFileReference section */
28 | 7A538A51239FCCDE005B9E1E /* JournalCoreDataSwiftUI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JournalCoreDataSwiftUI.app; sourceTree = BUILT_PRODUCTS_DIR; };
29 | 7A538A54239FCCDE005B9E1E /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
30 | 7A538A56239FCCDE005B9E1E /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; };
31 | 7A538A58239FCCDE005B9E1E /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; };
32 | 7A538A5A239FCCE5005B9E1E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
33 | 7A538A5D239FCCE5005B9E1E /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; };
34 | 7A538A60239FCCE5005B9E1E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
35 | 7A538A62239FCCE5005B9E1E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
36 | 7A538A69239FCEBD005B9E1E /* JournalCoreDataSwiftUI.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = JournalCoreDataSwiftUI.xcdatamodel; sourceTree = ""; };
37 | 7A538A6B239FCF7E005B9E1E /* CoreDataStack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreDataStack.swift; sourceTree = ""; };
38 | 7A538A6D239FCFD3005B9E1E /* Entry+Convenience.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Entry+Convenience.swift"; sourceTree = ""; };
39 | 7A538A6F239FD09C005B9E1E /* EntryController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntryController.swift; sourceTree = ""; };
40 | 7A99CA5123A112A800BCD9BC /* RowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RowView.swift; sourceTree = ""; };
41 | 7A99CA5323A118DC00BCD9BC /* AddEntryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddEntryView.swift; sourceTree = ""; };
42 | 7A99CA5523A19AB200BCD9BC /* DetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailView.swift; sourceTree = ""; };
43 | 7A99CA5723A19FB700BCD9BC /* EditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditView.swift; sourceTree = ""; };
44 | 7A99CA5923A2704000BCD9BC /* MultiLineTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultiLineTextField.swift; sourceTree = ""; };
45 | /* End PBXFileReference section */
46 |
47 | /* Begin PBXFrameworksBuildPhase section */
48 | 7A538A4E239FCCDE005B9E1E /* Frameworks */ = {
49 | isa = PBXFrameworksBuildPhase;
50 | buildActionMask = 2147483647;
51 | files = (
52 | );
53 | runOnlyForDeploymentPostprocessing = 0;
54 | };
55 | /* End PBXFrameworksBuildPhase section */
56 |
57 | /* Begin PBXGroup section */
58 | 7A538A48239FCCDE005B9E1E = {
59 | isa = PBXGroup;
60 | children = (
61 | 7A538A53239FCCDE005B9E1E /* JournalCoreDataSwiftUI */,
62 | 7A538A52239FCCDE005B9E1E /* Products */,
63 | );
64 | sourceTree = "";
65 | };
66 | 7A538A52239FCCDE005B9E1E /* Products */ = {
67 | isa = PBXGroup;
68 | children = (
69 | 7A538A51239FCCDE005B9E1E /* JournalCoreDataSwiftUI.app */,
70 | );
71 | name = Products;
72 | sourceTree = "";
73 | };
74 | 7A538A53239FCCDE005B9E1E /* JournalCoreDataSwiftUI */ = {
75 | isa = PBXGroup;
76 | children = (
77 | 7A538A54239FCCDE005B9E1E /* AppDelegate.swift */,
78 | 7A538A56239FCCDE005B9E1E /* SceneDelegate.swift */,
79 | 7A538A6B239FCF7E005B9E1E /* CoreDataStack.swift */,
80 | 7A99CA5923A2704000BCD9BC /* MultiLineTextField.swift */,
81 | 7A99CA5B23A3B49000BCD9BC /* Model */,
82 | 7A99CA5C23A3B4A000BCD9BC /* Model Controller */,
83 | 7A99CA5D23A3B4B300BCD9BC /* Views */,
84 | 7A538A5A239FCCE5005B9E1E /* Assets.xcassets */,
85 | 7A538A5F239FCCE5005B9E1E /* LaunchScreen.storyboard */,
86 | 7A538A62239FCCE5005B9E1E /* Info.plist */,
87 | 7A538A5C239FCCE5005B9E1E /* Preview Content */,
88 | );
89 | path = JournalCoreDataSwiftUI;
90 | sourceTree = "";
91 | };
92 | 7A538A5C239FCCE5005B9E1E /* Preview Content */ = {
93 | isa = PBXGroup;
94 | children = (
95 | 7A538A5D239FCCE5005B9E1E /* Preview Assets.xcassets */,
96 | );
97 | path = "Preview Content";
98 | sourceTree = "";
99 | };
100 | 7A99CA5B23A3B49000BCD9BC /* Model */ = {
101 | isa = PBXGroup;
102 | children = (
103 | 7A538A68239FCEBD005B9E1E /* JournalCoreDataSwiftUI.xcdatamodeld */,
104 | 7A538A6D239FCFD3005B9E1E /* Entry+Convenience.swift */,
105 | );
106 | path = Model;
107 | sourceTree = "";
108 | };
109 | 7A99CA5C23A3B4A000BCD9BC /* Model Controller */ = {
110 | isa = PBXGroup;
111 | children = (
112 | 7A538A6F239FD09C005B9E1E /* EntryController.swift */,
113 | );
114 | path = "Model Controller";
115 | sourceTree = "";
116 | };
117 | 7A99CA5D23A3B4B300BCD9BC /* Views */ = {
118 | isa = PBXGroup;
119 | children = (
120 | 7A538A58239FCCDE005B9E1E /* ContentView.swift */,
121 | 7A99CA5123A112A800BCD9BC /* RowView.swift */,
122 | 7A99CA5323A118DC00BCD9BC /* AddEntryView.swift */,
123 | 7A99CA5523A19AB200BCD9BC /* DetailView.swift */,
124 | 7A99CA5723A19FB700BCD9BC /* EditView.swift */,
125 | );
126 | path = Views;
127 | sourceTree = "";
128 | };
129 | /* End PBXGroup section */
130 |
131 | /* Begin PBXNativeTarget section */
132 | 7A538A50239FCCDE005B9E1E /* JournalCoreDataSwiftUI */ = {
133 | isa = PBXNativeTarget;
134 | buildConfigurationList = 7A538A65239FCCE5005B9E1E /* Build configuration list for PBXNativeTarget "JournalCoreDataSwiftUI" */;
135 | buildPhases = (
136 | 7A538A4D239FCCDE005B9E1E /* Sources */,
137 | 7A538A4E239FCCDE005B9E1E /* Frameworks */,
138 | 7A538A4F239FCCDE005B9E1E /* Resources */,
139 | );
140 | buildRules = (
141 | );
142 | dependencies = (
143 | );
144 | name = JournalCoreDataSwiftUI;
145 | productName = JournalCoreDataSwiftUI;
146 | productReference = 7A538A51239FCCDE005B9E1E /* JournalCoreDataSwiftUI.app */;
147 | productType = "com.apple.product-type.application";
148 | };
149 | /* End PBXNativeTarget section */
150 |
151 | /* Begin PBXProject section */
152 | 7A538A49239FCCDE005B9E1E /* Project object */ = {
153 | isa = PBXProject;
154 | attributes = {
155 | LastSwiftUpdateCheck = 1120;
156 | LastUpgradeCheck = 1120;
157 | ORGANIZATIONNAME = "Nelson Gonzalez";
158 | TargetAttributes = {
159 | 7A538A50239FCCDE005B9E1E = {
160 | CreatedOnToolsVersion = 11.2.1;
161 | };
162 | };
163 | };
164 | buildConfigurationList = 7A538A4C239FCCDE005B9E1E /* Build configuration list for PBXProject "JournalCoreDataSwiftUI" */;
165 | compatibilityVersion = "Xcode 9.3";
166 | developmentRegion = en;
167 | hasScannedForEncodings = 0;
168 | knownRegions = (
169 | en,
170 | Base,
171 | );
172 | mainGroup = 7A538A48239FCCDE005B9E1E;
173 | productRefGroup = 7A538A52239FCCDE005B9E1E /* Products */;
174 | projectDirPath = "";
175 | projectRoot = "";
176 | targets = (
177 | 7A538A50239FCCDE005B9E1E /* JournalCoreDataSwiftUI */,
178 | );
179 | };
180 | /* End PBXProject section */
181 |
182 | /* Begin PBXResourcesBuildPhase section */
183 | 7A538A4F239FCCDE005B9E1E /* Resources */ = {
184 | isa = PBXResourcesBuildPhase;
185 | buildActionMask = 2147483647;
186 | files = (
187 | 7A538A61239FCCE5005B9E1E /* LaunchScreen.storyboard in Resources */,
188 | 7A538A5E239FCCE5005B9E1E /* Preview Assets.xcassets in Resources */,
189 | 7A538A5B239FCCE5005B9E1E /* Assets.xcassets in Resources */,
190 | );
191 | runOnlyForDeploymentPostprocessing = 0;
192 | };
193 | /* End PBXResourcesBuildPhase section */
194 |
195 | /* Begin PBXSourcesBuildPhase section */
196 | 7A538A4D239FCCDE005B9E1E /* Sources */ = {
197 | isa = PBXSourcesBuildPhase;
198 | buildActionMask = 2147483647;
199 | files = (
200 | 7A538A6C239FCF7E005B9E1E /* CoreDataStack.swift in Sources */,
201 | 7A538A6A239FCEBD005B9E1E /* JournalCoreDataSwiftUI.xcdatamodeld in Sources */,
202 | 7A99CA5823A19FB700BCD9BC /* EditView.swift in Sources */,
203 | 7A538A70239FD09C005B9E1E /* EntryController.swift in Sources */,
204 | 7A99CA5623A19AB300BCD9BC /* DetailView.swift in Sources */,
205 | 7A99CA5223A112A800BCD9BC /* RowView.swift in Sources */,
206 | 7A538A55239FCCDE005B9E1E /* AppDelegate.swift in Sources */,
207 | 7A99CA5A23A2704000BCD9BC /* MultiLineTextField.swift in Sources */,
208 | 7A538A57239FCCDE005B9E1E /* SceneDelegate.swift in Sources */,
209 | 7A99CA5423A118DC00BCD9BC /* AddEntryView.swift in Sources */,
210 | 7A538A6E239FCFD3005B9E1E /* Entry+Convenience.swift in Sources */,
211 | 7A538A59239FCCDE005B9E1E /* ContentView.swift in Sources */,
212 | );
213 | runOnlyForDeploymentPostprocessing = 0;
214 | };
215 | /* End PBXSourcesBuildPhase section */
216 |
217 | /* Begin PBXVariantGroup section */
218 | 7A538A5F239FCCE5005B9E1E /* LaunchScreen.storyboard */ = {
219 | isa = PBXVariantGroup;
220 | children = (
221 | 7A538A60239FCCE5005B9E1E /* Base */,
222 | );
223 | name = LaunchScreen.storyboard;
224 | sourceTree = "";
225 | };
226 | /* End PBXVariantGroup section */
227 |
228 | /* Begin XCBuildConfiguration section */
229 | 7A538A63239FCCE5005B9E1E /* Debug */ = {
230 | isa = XCBuildConfiguration;
231 | buildSettings = {
232 | ALWAYS_SEARCH_USER_PATHS = NO;
233 | CLANG_ANALYZER_NONNULL = YES;
234 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
235 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
236 | CLANG_CXX_LIBRARY = "libc++";
237 | CLANG_ENABLE_MODULES = YES;
238 | CLANG_ENABLE_OBJC_ARC = YES;
239 | CLANG_ENABLE_OBJC_WEAK = YES;
240 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
241 | CLANG_WARN_BOOL_CONVERSION = YES;
242 | CLANG_WARN_COMMA = YES;
243 | CLANG_WARN_CONSTANT_CONVERSION = YES;
244 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
245 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
246 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
247 | CLANG_WARN_EMPTY_BODY = YES;
248 | CLANG_WARN_ENUM_CONVERSION = YES;
249 | CLANG_WARN_INFINITE_RECURSION = YES;
250 | CLANG_WARN_INT_CONVERSION = YES;
251 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
252 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
253 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
254 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
255 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
256 | CLANG_WARN_STRICT_PROTOTYPES = YES;
257 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
258 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
259 | CLANG_WARN_UNREACHABLE_CODE = YES;
260 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
261 | COPY_PHASE_STRIP = NO;
262 | DEBUG_INFORMATION_FORMAT = dwarf;
263 | ENABLE_STRICT_OBJC_MSGSEND = YES;
264 | ENABLE_TESTABILITY = YES;
265 | GCC_C_LANGUAGE_STANDARD = gnu11;
266 | GCC_DYNAMIC_NO_PIC = NO;
267 | GCC_NO_COMMON_BLOCKS = YES;
268 | GCC_OPTIMIZATION_LEVEL = 0;
269 | GCC_PREPROCESSOR_DEFINITIONS = (
270 | "DEBUG=1",
271 | "$(inherited)",
272 | );
273 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
274 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
275 | GCC_WARN_UNDECLARED_SELECTOR = YES;
276 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
277 | GCC_WARN_UNUSED_FUNCTION = YES;
278 | GCC_WARN_UNUSED_VARIABLE = YES;
279 | IPHONEOS_DEPLOYMENT_TARGET = 13.2;
280 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
281 | MTL_FAST_MATH = YES;
282 | ONLY_ACTIVE_ARCH = YES;
283 | SDKROOT = iphoneos;
284 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
285 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
286 | };
287 | name = Debug;
288 | };
289 | 7A538A64239FCCE5005B9E1E /* Release */ = {
290 | isa = XCBuildConfiguration;
291 | buildSettings = {
292 | ALWAYS_SEARCH_USER_PATHS = NO;
293 | CLANG_ANALYZER_NONNULL = YES;
294 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
295 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
296 | CLANG_CXX_LIBRARY = "libc++";
297 | CLANG_ENABLE_MODULES = YES;
298 | CLANG_ENABLE_OBJC_ARC = YES;
299 | CLANG_ENABLE_OBJC_WEAK = YES;
300 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
301 | CLANG_WARN_BOOL_CONVERSION = YES;
302 | CLANG_WARN_COMMA = YES;
303 | CLANG_WARN_CONSTANT_CONVERSION = YES;
304 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
305 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
306 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
307 | CLANG_WARN_EMPTY_BODY = YES;
308 | CLANG_WARN_ENUM_CONVERSION = YES;
309 | CLANG_WARN_INFINITE_RECURSION = YES;
310 | CLANG_WARN_INT_CONVERSION = YES;
311 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
312 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
313 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
314 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
315 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
316 | CLANG_WARN_STRICT_PROTOTYPES = YES;
317 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
318 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
319 | CLANG_WARN_UNREACHABLE_CODE = YES;
320 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
321 | COPY_PHASE_STRIP = NO;
322 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
323 | ENABLE_NS_ASSERTIONS = NO;
324 | ENABLE_STRICT_OBJC_MSGSEND = YES;
325 | GCC_C_LANGUAGE_STANDARD = gnu11;
326 | GCC_NO_COMMON_BLOCKS = YES;
327 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
328 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
329 | GCC_WARN_UNDECLARED_SELECTOR = YES;
330 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
331 | GCC_WARN_UNUSED_FUNCTION = YES;
332 | GCC_WARN_UNUSED_VARIABLE = YES;
333 | IPHONEOS_DEPLOYMENT_TARGET = 13.2;
334 | MTL_ENABLE_DEBUG_INFO = NO;
335 | MTL_FAST_MATH = YES;
336 | SDKROOT = iphoneos;
337 | SWIFT_COMPILATION_MODE = wholemodule;
338 | SWIFT_OPTIMIZATION_LEVEL = "-O";
339 | VALIDATE_PRODUCT = YES;
340 | };
341 | name = Release;
342 | };
343 | 7A538A66239FCCE5005B9E1E /* Debug */ = {
344 | isa = XCBuildConfiguration;
345 | buildSettings = {
346 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
347 | CODE_SIGN_STYLE = Automatic;
348 | DEVELOPMENT_ASSET_PATHS = "\"JournalCoreDataSwiftUI/Preview Content\"";
349 | DEVELOPMENT_TEAM = ZD9LN99SX6;
350 | ENABLE_PREVIEWS = YES;
351 | INFOPLIST_FILE = JournalCoreDataSwiftUI/Info.plist;
352 | LD_RUNPATH_SEARCH_PATHS = (
353 | "$(inherited)",
354 | "@executable_path/Frameworks",
355 | );
356 | PRODUCT_BUNDLE_IDENTIFIER = com.nelsongonzalez.JournalCoreDataSwiftUI;
357 | PRODUCT_NAME = "$(TARGET_NAME)";
358 | SWIFT_VERSION = 5.0;
359 | TARGETED_DEVICE_FAMILY = "1,2";
360 | };
361 | name = Debug;
362 | };
363 | 7A538A67239FCCE5005B9E1E /* Release */ = {
364 | isa = XCBuildConfiguration;
365 | buildSettings = {
366 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
367 | CODE_SIGN_STYLE = Automatic;
368 | DEVELOPMENT_ASSET_PATHS = "\"JournalCoreDataSwiftUI/Preview Content\"";
369 | DEVELOPMENT_TEAM = ZD9LN99SX6;
370 | ENABLE_PREVIEWS = YES;
371 | INFOPLIST_FILE = JournalCoreDataSwiftUI/Info.plist;
372 | LD_RUNPATH_SEARCH_PATHS = (
373 | "$(inherited)",
374 | "@executable_path/Frameworks",
375 | );
376 | PRODUCT_BUNDLE_IDENTIFIER = com.nelsongonzalez.JournalCoreDataSwiftUI;
377 | PRODUCT_NAME = "$(TARGET_NAME)";
378 | SWIFT_VERSION = 5.0;
379 | TARGETED_DEVICE_FAMILY = "1,2";
380 | };
381 | name = Release;
382 | };
383 | /* End XCBuildConfiguration section */
384 |
385 | /* Begin XCConfigurationList section */
386 | 7A538A4C239FCCDE005B9E1E /* Build configuration list for PBXProject "JournalCoreDataSwiftUI" */ = {
387 | isa = XCConfigurationList;
388 | buildConfigurations = (
389 | 7A538A63239FCCE5005B9E1E /* Debug */,
390 | 7A538A64239FCCE5005B9E1E /* Release */,
391 | );
392 | defaultConfigurationIsVisible = 0;
393 | defaultConfigurationName = Release;
394 | };
395 | 7A538A65239FCCE5005B9E1E /* Build configuration list for PBXNativeTarget "JournalCoreDataSwiftUI" */ = {
396 | isa = XCConfigurationList;
397 | buildConfigurations = (
398 | 7A538A66239FCCE5005B9E1E /* Debug */,
399 | 7A538A67239FCCE5005B9E1E /* Release */,
400 | );
401 | defaultConfigurationIsVisible = 0;
402 | defaultConfigurationName = Release;
403 | };
404 | /* End XCConfigurationList section */
405 |
406 | /* Begin XCVersionGroup section */
407 | 7A538A68239FCEBD005B9E1E /* JournalCoreDataSwiftUI.xcdatamodeld */ = {
408 | isa = XCVersionGroup;
409 | children = (
410 | 7A538A69239FCEBD005B9E1E /* JournalCoreDataSwiftUI.xcdatamodel */,
411 | );
412 | currentVersion = 7A538A69239FCEBD005B9E1E /* JournalCoreDataSwiftUI.xcdatamodel */;
413 | path = JournalCoreDataSwiftUI.xcdatamodeld;
414 | sourceTree = "";
415 | versionGroupType = wrapper.xcdatamodel;
416 | };
417 | /* End XCVersionGroup section */
418 | };
419 | rootObject = 7A538A49239FCCDE005B9E1E /* Project object */;
420 | }
421 |
--------------------------------------------------------------------------------