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
4 changes: 4 additions & 0 deletions CoreDataTutorialPart1Final.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
7BD171551E6792420012FF66 /* Photo+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD171531E6792420012FF66 /* Photo+CoreDataClass.swift */; };
7BD171561E6792420012FF66 /* Photo+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD171541E6792420012FF66 /* Photo+CoreDataProperties.swift */; };
7BD171581E679CE80012FF66 /* CoreDataStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD171571E679CE80012FF66 /* CoreDataStack.swift */; };
E7EF1DBA1FCB48BF00A3BE03 /* CustomTabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7EF1DB91FCB48BE00A3BE03 /* CustomTabBarController.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -34,6 +35,7 @@
7BD171531E6792420012FF66 /* Photo+CoreDataClass.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Photo+CoreDataClass.swift"; sourceTree = "<group>"; };
7BD171541E6792420012FF66 /* Photo+CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Photo+CoreDataProperties.swift"; sourceTree = "<group>"; };
7BD171571E679CE80012FF66 /* CoreDataStack.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataStack.swift; sourceTree = "<group>"; };
E7EF1DB91FCB48BE00A3BE03 /* CustomTabBarController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomTabBarController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -102,6 +104,7 @@
isa = PBXGroup;
children = (
7BD1714F1E6782750012FF66 /* PhotoVC.swift */,
E7EF1DB91FCB48BE00A3BE03 /* CustomTabBarController.swift */,
);
name = Controller;
sourceTree = "<group>";
Expand Down Expand Up @@ -180,6 +183,7 @@
files = (
7BD171581E679CE80012FF66 /* CoreDataStack.swift in Sources */,
7B4DA3571E6B9DB4008CFF8A /* Extensions.swift in Sources */,
E7EF1DBA1FCB48BF00A3BE03 /* CustomTabBarController.swift in Sources */,
7BD171561E6792420012FF66 /* Photo+CoreDataProperties.swift in Sources */,
7BD171551E6792420012FF66 /* Photo+CoreDataClass.swift in Sources */,
7BD171521E6782800012FF66 /* PhotoCell.swift in Sources */,
Expand Down
34 changes: 20 additions & 14 deletions CoreDataTutorialPart1Final/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,51 @@ import CoreData

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
window?.makeKeyAndVisible()
let photoVC = PhotoVC()
window?.rootViewController = UINavigationController(rootViewController: photoVC)

// let photoVC = PhotoVC()
// window?.rootViewController = UINavigationController(rootViewController: photoVC)
CoreDataStack.sharedInstance.applicationDocumentsDirectory()

window?.rootViewController = CustumTabBarController()

return true
}




func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}

func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
// Saves changes in the application's managed object context before the application terminates.
CoreDataStack.sharedInstance.saveContext()
}




}

35 changes: 35 additions & 0 deletions CoreDataTutorialPart1Final/CustomTabBarController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// CustomTabBarController.swift
// CoreDataTutorialPart1Final
//
// Created by Vladimir Gutic on 11/26/17.
// Copyright © 2017 James Rochabrun. All rights reserved.
////
//
import UIKit
class CustumTabBarController: UITabBarController {

override func viewDidLoad () {
super.viewDidLoad()

// MARK: -Setup View Controller


let photoVC = PhotoVC()
let navController = UINavigationController(rootViewController: photoVC)
navController.tabBarItem.title = "Photos"
navController.tabBarItem.image = UIImage (named: "")

let profileController = PhotoVC ()
let secondNavigationController = UINavigationController (rootViewController: profileController)
secondNavigationController.title = "Profile"
secondNavigationController.tabBarItem.image = UIImage (named: "image")


viewControllers = [navController, secondNavigationController]

}

}


2 changes: 1 addition & 1 deletion CoreDataTutorialPart1Final/PhotoVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class PhotoVC: UITableViewController {

override func viewDidLoad() {
super.viewDidLoad()
self.title = "Photos Feed"
// self.title = "Photos Feed"
view.backgroundColor = .white
tableView.register(PhotoCell.self, forCellReuseIdentifier: cellID)
updateTableContent()
Expand Down