Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactors to MVC #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
38 changes: 8 additions & 30 deletions MyToDo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@

/* Begin PBXBuildFile section */
FDB90350200F214B00B7874B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDB9034F200F214B00B7874B /* AppDelegate.swift */; };
FDB90352200F214B00B7874B /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDB90351200F214B00B7874B /* ViewController.swift */; };
FDB90355200F214B00B7874B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FDB90353200F214B00B7874B /* Main.storyboard */; };
FDB90357200F214B00B7874B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FDB90356200F214B00B7874B /* Assets.xcassets */; };
FDB9035A200F214B00B7874B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FDB90358200F214B00B7874B /* LaunchScreen.storyboard */; };
FDB90365200F214B00B7874B /* MyToDoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDB90364200F214B00B7874B /* MyToDoTests.swift */; };
FDB90370200F22CA00B7874B /* ToDoItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDB9036F200F22CA00B7874B /* ToDoItem.swift */; };
FDB90372200F23ED00B7874B /* ItemTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDB90371200F23ED00B7874B /* ItemTableViewController.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -28,14 +27,12 @@
/* Begin PBXFileReference section */
FDB9034C200F214B00B7874B /* MyToDo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MyToDo.app; sourceTree = BUILT_PRODUCTS_DIR; };
FDB9034F200F214B00B7874B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
FDB90351200F214B00B7874B /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
FDB90354200F214B00B7874B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
FDB90356200F214B00B7874B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
FDB90359200F214B00B7874B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
FDB9035B200F214B00B7874B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
FDB90360200F214B00B7874B /* MyToDoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MyToDoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
FDB90364200F214B00B7874B /* MyToDoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyToDoTests.swift; sourceTree = "<group>"; };
FDB90366200F214B00B7874B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
FDB9036F200F22CA00B7874B /* ToDoItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToDoItem.swift; sourceTree = "<group>"; };
FDB90371200F23ED00B7874B /* ItemTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemTableViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -60,7 +57,6 @@
isa = PBXGroup;
children = (
FDB9034E200F214B00B7874B /* MyToDo */,
FDB90363200F214B00B7874B /* MyToDoTests */,
FDB9034D200F214B00B7874B /* Products */,
);
sourceTree = "<group>";
Expand All @@ -78,24 +74,15 @@
isa = PBXGroup;
children = (
FDB9034F200F214B00B7874B /* AppDelegate.swift */,
FDB90351200F214B00B7874B /* ViewController.swift */,
FDB90353200F214B00B7874B /* Main.storyboard */,
FDB90356200F214B00B7874B /* Assets.xcassets */,
FDB90358200F214B00B7874B /* LaunchScreen.storyboard */,
FDB9035B200F214B00B7874B /* Info.plist */,
FDB9036F200F22CA00B7874B /* ToDoItem.swift */,
FDB90371200F23ED00B7874B /* ItemTableViewController.swift */,
);
path = MyToDo;
sourceTree = "<group>";
};
FDB90363200F214B00B7874B /* MyToDoTests */ = {
isa = PBXGroup;
children = (
FDB90364200F214B00B7874B /* MyToDoTests.swift */,
FDB90366200F214B00B7874B /* Info.plist */,
);
path = MyToDoTests;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -179,7 +166,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FDB9035A200F214B00B7874B /* LaunchScreen.storyboard in Resources */,
FDB90357200F214B00B7874B /* Assets.xcassets in Resources */,
FDB90355200F214B00B7874B /* Main.storyboard in Resources */,
);
Expand All @@ -199,16 +185,16 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FDB90352200F214B00B7874B /* ViewController.swift in Sources */,
FDB90350200F214B00B7874B /* AppDelegate.swift in Sources */,
FDB90372200F23ED00B7874B /* ItemTableViewController.swift in Sources */,
FDB90370200F22CA00B7874B /* ToDoItem.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
FDB9035C200F214B00B7874B /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FDB90365200F214B00B7874B /* MyToDoTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -231,14 +217,6 @@
name = Main.storyboard;
sourceTree = "<group>";
};
FDB90358200F214B00B7874B /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
FDB90359200F214B00B7874B /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
</Bucket>
25 changes: 12 additions & 13 deletions MyToDo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,36 @@ import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?



var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
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.
// 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:.

}


}

5 changes: 5 additions & 0 deletions MyToDo/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
Expand Down
6 changes: 6 additions & 0 deletions MyToDo/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
23 changes: 23 additions & 0 deletions MyToDo/Assets.xcassets/Image.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "a36427a4-43e0-4bff-9f67-2d0aec6e76e1-2.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "a36427a4-43e0-4bff-9f67-2d0aec6e76e1-1.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "a36427a4-43e0-4bff-9f67-2d0aec6e76e1.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 0 additions & 25 deletions MyToDo/Base.lproj/LaunchScreen.storyboard

This file was deleted.

80 changes: 68 additions & 12 deletions MyToDo/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,24 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" systemVersion="17A277" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Uob-8Y-feg">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<!--My To-do-->
<scene sceneID="W3H-XE-ajU">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<tableViewController id="Xhe-oU-rlf" customClass="ItemTableViewController" customModule="MyToDo" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="6iJ-kh-jhn">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="sectionIndexBackgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" textLabel="a1Y-UN-beI" style="IBUITableViewCellStyleDefault" id="hSV-qL-KFC">
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="hSV-qL-KFC" id="cqk-O5-Loz">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="a1Y-UN-beI">
<rect key="frame" x="16" y="0.0" width="343" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<gestureRecognizers/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="Xhe-oU-rlf" id="FrS-UW-IRY"/>
<outlet property="delegate" destination="Xhe-oU-rlf" id="t2T-DE-B2S"/>
</connections>
</tableView>
<navigationItem key="navigationItem" title="My To-do" id="8rz-YV-8CE">
<barButtonItem key="rightBarButtonItem" systemItem="add" id="7I4-rg-3VF">
<connections>
<action selector="didTapAdd:" destination="Xhe-oU-rlf" id="v2Q-3w-vYF"/>
</connections>
</barButtonItem>
</navigationItem>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ZId-7A-DRP" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1740" y="114"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="V7W-hh-nGM">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="Uob-8Y-feg" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="UWs-hx-ls1">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<textAttributes key="titleTextAttributes">
<color key="textColor" red="1" green="0.20873683953272482" blue="0.28655010940186765" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
</textAttributes>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="Xhe-oU-rlf" kind="relationship" relationship="rootViewController" id="K84-9Q-gqT"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Jwd-qT-nC1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="790.39999999999998" y="123.23838080959521"/>
</scene>
</scenes>
</document>
2 changes: 1 addition & 1 deletion MyToDo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<string>Main</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
Expand Down
Loading