Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit 762c84f

Browse files
committed
first commit
0 parents  commit 762c84f

File tree

19 files changed

+1352
-0
lines changed

19 files changed

+1352
-0
lines changed

ListaCoreData.xcodeproj/project.pbxproj

Lines changed: 453 additions & 0 deletions
Large diffs are not rendered by default.

ListaCoreData.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Bucket
3+
type = "1"
4+
version = "2.0">
5+
</Bucket>
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0640"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "9646CAE51B8E8B60003FF188"
18+
BuildableName = "ListaCoreData.app"
19+
BlueprintName = "ListaCoreData"
20+
ReferencedContainer = "container:ListaCoreData.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
<BuildActionEntry
24+
buildForTesting = "YES"
25+
buildForRunning = "YES"
26+
buildForProfiling = "NO"
27+
buildForArchiving = "NO"
28+
buildForAnalyzing = "YES">
29+
<BuildableReference
30+
BuildableIdentifier = "primary"
31+
BlueprintIdentifier = "9646CAFD1B8E8B61003FF188"
32+
BuildableName = "ListaCoreDataTests.xctest"
33+
BlueprintName = "ListaCoreDataTests"
34+
ReferencedContainer = "container:ListaCoreData.xcodeproj">
35+
</BuildableReference>
36+
</BuildActionEntry>
37+
</BuildActionEntries>
38+
</BuildAction>
39+
<TestAction
40+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
41+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
42+
shouldUseLaunchSchemeArgsEnv = "YES"
43+
buildConfiguration = "Debug">
44+
<Testables>
45+
<TestableReference
46+
skipped = "NO">
47+
<BuildableReference
48+
BuildableIdentifier = "primary"
49+
BlueprintIdentifier = "9646CAFD1B8E8B61003FF188"
50+
BuildableName = "ListaCoreDataTests.xctest"
51+
BlueprintName = "ListaCoreDataTests"
52+
ReferencedContainer = "container:ListaCoreData.xcodeproj">
53+
</BuildableReference>
54+
</TestableReference>
55+
</Testables>
56+
<MacroExpansion>
57+
<BuildableReference
58+
BuildableIdentifier = "primary"
59+
BlueprintIdentifier = "9646CAE51B8E8B60003FF188"
60+
BuildableName = "ListaCoreData.app"
61+
BlueprintName = "ListaCoreData"
62+
ReferencedContainer = "container:ListaCoreData.xcodeproj">
63+
</BuildableReference>
64+
</MacroExpansion>
65+
</TestAction>
66+
<LaunchAction
67+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
68+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
69+
launchStyle = "0"
70+
useCustomWorkingDirectory = "NO"
71+
buildConfiguration = "Debug"
72+
ignoresPersistentStateOnLaunch = "NO"
73+
debugDocumentVersioning = "YES"
74+
allowLocationSimulation = "YES">
75+
<BuildableProductRunnable
76+
runnableDebuggingMode = "0">
77+
<BuildableReference
78+
BuildableIdentifier = "primary"
79+
BlueprintIdentifier = "9646CAE51B8E8B60003FF188"
80+
BuildableName = "ListaCoreData.app"
81+
BlueprintName = "ListaCoreData"
82+
ReferencedContainer = "container:ListaCoreData.xcodeproj">
83+
</BuildableReference>
84+
</BuildableProductRunnable>
85+
<AdditionalOptions>
86+
</AdditionalOptions>
87+
</LaunchAction>
88+
<ProfileAction
89+
shouldUseLaunchSchemeArgsEnv = "YES"
90+
savedToolIdentifier = ""
91+
useCustomWorkingDirectory = "NO"
92+
buildConfiguration = "Release"
93+
debugDocumentVersioning = "YES">
94+
<BuildableProductRunnable
95+
runnableDebuggingMode = "0">
96+
<BuildableReference
97+
BuildableIdentifier = "primary"
98+
BlueprintIdentifier = "9646CAE51B8E8B60003FF188"
99+
BuildableName = "ListaCoreData.app"
100+
BlueprintName = "ListaCoreData"
101+
ReferencedContainer = "container:ListaCoreData.xcodeproj">
102+
</BuildableReference>
103+
</BuildableProductRunnable>
104+
</ProfileAction>
105+
<AnalyzeAction
106+
buildConfiguration = "Debug">
107+
</AnalyzeAction>
108+
<ArchiveAction
109+
buildConfiguration = "Release"
110+
revealArchiveInOrganizer = "YES">
111+
</ArchiveAction>
112+
</Scheme>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>SchemeUserState</key>
6+
<dict>
7+
<key>ListaCoreData.xcscheme</key>
8+
<dict>
9+
<key>orderHint</key>
10+
<integer>0</integer>
11+
</dict>
12+
</dict>
13+
<key>SuppressBuildableAutocreation</key>
14+
<dict>
15+
<key>9646CAE51B8E8B60003FF188</key>
16+
<dict>
17+
<key>primary</key>
18+
<true/>
19+
</dict>
20+
<key>9646CAFD1B8E8B61003FF188</key>
21+
<dict>
22+
<key>primary</key>
23+
<true/>
24+
</dict>
25+
</dict>
26+
</dict>
27+
</plist>

ListaCoreData/AppDelegate.swift

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
//
2+
// AppDelegate.swift
3+
// ListaCoreData
4+
//
5+
// Created by Diego Rossini Vieira on 8/26/15.
6+
// Copyright (c) 2015 Diego Rossini Vieira. All rights reserved.
7+
//
8+
9+
import UIKit
10+
import CoreData
11+
12+
@UIApplicationMain
13+
class AppDelegate: UIResponder, UIApplicationDelegate {
14+
15+
var window: UIWindow?
16+
17+
18+
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
19+
// Override point for customization after application launch.
20+
return true
21+
}
22+
23+
func applicationWillResignActive(application: UIApplication) {
24+
// 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.
25+
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
26+
}
27+
28+
func applicationDidEnterBackground(application: UIApplication) {
29+
// 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.
30+
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
31+
}
32+
33+
func applicationWillEnterForeground(application: UIApplication) {
34+
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
35+
}
36+
37+
func applicationDidBecomeActive(application: UIApplication) {
38+
// 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.
39+
}
40+
41+
func applicationWillTerminate(application: UIApplication) {
42+
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
43+
// Saves changes in the application's managed object context before the application terminates.
44+
self.saveContext()
45+
}
46+
47+
// MARK: - Core Data stack
48+
49+
lazy var applicationDocumentsDirectory: NSURL = {
50+
// The directory the application uses to store the Core Data store file. This code uses a directory named "com.diegorv.ListaCoreData" in the application's documents Application Support directory.
51+
let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
52+
return urls[urls.count-1] as! NSURL
53+
}()
54+
55+
lazy var managedObjectModel: NSManagedObjectModel = {
56+
// The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model.
57+
let modelURL = NSBundle.mainBundle().URLForResource("ListaCoreData", withExtension: "momd")!
58+
return NSManagedObjectModel(contentsOfURL: modelURL)!
59+
}()
60+
61+
lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator? = {
62+
// The persistent store coordinator for the application. This implementation creates and return a coordinator, having added the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail.
63+
// Create the coordinator and store
64+
var coordinator: NSPersistentStoreCoordinator? = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel)
65+
let url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("ListaCoreData.sqlite")
66+
var error: NSError? = nil
67+
var failureReason = "There was an error creating or loading the application's saved data."
68+
if coordinator!.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: nil, error: &error) == nil {
69+
coordinator = nil
70+
// Report any error we got.
71+
var dict = [String: AnyObject]()
72+
dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data"
73+
dict[NSLocalizedFailureReasonErrorKey] = failureReason
74+
dict[NSUnderlyingErrorKey] = error
75+
error = NSError(domain: "YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict)
76+
// Replace this with code to handle the error appropriately.
77+
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
78+
NSLog("Unresolved error \(error), \(error!.userInfo)")
79+
abort()
80+
}
81+
82+
return coordinator
83+
}()
84+
85+
lazy var managedObjectContext: NSManagedObjectContext? = {
86+
// Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) This property is optional since there are legitimate error conditions that could cause the creation of the context to fail.
87+
let coordinator = self.persistentStoreCoordinator
88+
if coordinator == nil {
89+
return nil
90+
}
91+
var managedObjectContext = NSManagedObjectContext()
92+
managedObjectContext.persistentStoreCoordinator = coordinator
93+
return managedObjectContext
94+
}()
95+
96+
// MARK: - Core Data Saving support
97+
98+
func saveContext () {
99+
if let moc = self.managedObjectContext {
100+
var error: NSError? = nil
101+
if moc.hasChanges && !moc.save(&error) {
102+
// Replace this implementation with code to handle the error appropriately.
103+
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
104+
NSLog("Unresolved error \(error), \(error!.userInfo)")
105+
abort()
106+
}
107+
}
108+
}
109+
110+
}
111+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207"/>
5+
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
6+
</dependencies>
7+
<objects>
8+
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
9+
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
10+
<view contentMode="scaleToFill" id="iN0-l3-epB">
11+
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
12+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
13+
<subviews>
14+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015 Diego Rossini Vieira. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
15+
<rect key="frame" x="20" y="439" width="441" height="21"/>
16+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
17+
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
18+
<nil key="highlightedColor"/>
19+
</label>
20+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ListaCoreData" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
21+
<rect key="frame" x="20" y="140" width="441" height="43"/>
22+
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
23+
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
24+
<nil key="highlightedColor"/>
25+
</label>
26+
</subviews>
27+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
28+
<constraints>
29+
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
30+
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
31+
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
32+
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
33+
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
34+
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
35+
</constraints>
36+
<nil key="simulatedStatusBarMetrics"/>
37+
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
38+
<point key="canvasLocation" x="548" y="455"/>
39+
</view>
40+
</objects>
41+
</document>
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="cHo-5I-4hp">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
5+
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
6+
</dependencies>
7+
<scenes>
8+
<!--View Controller-->
9+
<scene sceneID="tne-QT-ifu">
10+
<objects>
11+
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="ListaCoreData" customModuleProvider="target" sceneMemberID="viewController">
12+
<layoutGuides>
13+
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
14+
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
15+
</layoutGuides>
16+
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
17+
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
18+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
19+
<subviews>
20+
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="Qna-iI-gHe">
21+
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
22+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
23+
<connections>
24+
<outlet property="dataSource" destination="BYZ-38-t0r" id="M53-r4-3LT"/>
25+
<outlet property="delegate" destination="BYZ-38-t0r" id="DZZ-jS-Mc0"/>
26+
</connections>
27+
</tableView>
28+
</subviews>
29+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
30+
<constraints>
31+
<constraint firstItem="Qna-iI-gHe" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="topMargin" id="8fN-e1-3nL"/>
32+
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="Qna-iI-gHe" secondAttribute="bottom" id="bAR-wM-Flj"/>
33+
<constraint firstAttribute="trailingMargin" secondItem="Qna-iI-gHe" secondAttribute="trailing" constant="-16" id="neR-YJ-qCr"/>
34+
<constraint firstItem="Qna-iI-gHe" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" constant="-16" id="usc-6f-iaV"/>
35+
</constraints>
36+
</view>
37+
<navigationItem key="navigationItem" id="vaV-8b-8uC">
38+
<barButtonItem key="rightBarButtonItem" systemItem="add" id="QFh-AD-dvH">
39+
<connections>
40+
<action selector="addButton:" destination="BYZ-38-t0r" id="JJj-3X-qvq"/>
41+
</connections>
42+
</barButtonItem>
43+
</navigationItem>
44+
<connections>
45+
<outlet property="tableView" destination="Qna-iI-gHe" id="hr9-yi-TaU"/>
46+
</connections>
47+
</viewController>
48+
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
49+
</objects>
50+
<point key="canvasLocation" x="1252" y="349"/>
51+
</scene>
52+
<!--Navigation Controller-->
53+
<scene sceneID="1wQ-GW-xk0">
54+
<objects>
55+
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="cHo-5I-4hp" sceneMemberID="viewController">
56+
<toolbarItems/>
57+
<navigationBar key="navigationBar" contentMode="scaleToFill" id="5Ir-Ay-eDs">
58+
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
59+
<autoresizingMask key="autoresizingMask"/>
60+
</navigationBar>
61+
<nil name="viewControllers"/>
62+
<connections>
63+
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="U0e-rt-ynB"/>
64+
</connections>
65+
</navigationController>
66+
<placeholder placeholderIdentifier="IBFirstResponder" id="Did-wJ-3X5" userLabel="First Responder" sceneMemberID="firstResponder"/>
67+
</objects>
68+
<point key="canvasLocation" x="423" y="1010"/>
69+
</scene>
70+
</scenes>
71+
</document>

0 commit comments

Comments
 (0)