-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
eqiu1998
authored and
eqiu1998
committed
Jun 16, 2016
0 parents
commit 64ebbc2
Showing
18 changed files
with
1,371 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
ICS4UTutorialTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file added
BIN
+20.8 KB
...odeproj/project.xcworkspace/xcuserdata/ericqiu.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
5 changes: 5 additions & 0 deletions
5
...utorialTest.xcodeproj/xcuserdata/ericqiu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
111 changes: 111 additions & 0 deletions
111
...utorialTest.xcodeproj/xcuserdata/ericqiu.xcuserdatad/xcschemes/ICS4UTutorialTest.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "0730" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "132E14601D0C90680087BC6C" | ||
BuildableName = "ICS4UTutorialTest.app" | ||
BlueprintName = "ICS4UTutorialTest" | ||
ReferencedContainer = "container:ICS4UTutorialTest.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES"> | ||
<Testables> | ||
<TestableReference | ||
skipped = "NO"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "132E14741D0C90690087BC6C" | ||
BuildableName = "ICS4UTutorialTestTests.xctest" | ||
BlueprintName = "ICS4UTutorialTestTests" | ||
ReferencedContainer = "container:ICS4UTutorialTest.xcodeproj"> | ||
</BuildableReference> | ||
</TestableReference> | ||
<TestableReference | ||
skipped = "NO"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "132E147F1D0C90690087BC6C" | ||
BuildableName = "ICS4UTutorialTestUITests.xctest" | ||
BlueprintName = "ICS4UTutorialTestUITests" | ||
ReferencedContainer = "container:ICS4UTutorialTest.xcodeproj"> | ||
</BuildableReference> | ||
</TestableReference> | ||
</Testables> | ||
<MacroExpansion> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "132E14601D0C90680087BC6C" | ||
BuildableName = "ICS4UTutorialTest.app" | ||
BlueprintName = "ICS4UTutorialTest" | ||
ReferencedContainer = "container:ICS4UTutorialTest.xcodeproj"> | ||
</BuildableReference> | ||
</MacroExpansion> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "132E14601D0C90680087BC6C" | ||
BuildableName = "ICS4UTutorialTest.app" | ||
BlueprintName = "ICS4UTutorialTest" | ||
ReferencedContainer = "container:ICS4UTutorialTest.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "132E14601D0C90680087BC6C" | ||
BuildableName = "ICS4UTutorialTest.app" | ||
BlueprintName = "ICS4UTutorialTest" | ||
ReferencedContainer = "container:ICS4UTutorialTest.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
32 changes: 32 additions & 0 deletions
32
...UTutorialTest.xcodeproj/xcuserdata/ericqiu.xcuserdatad/xcschemes/xcschememanagement.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>SchemeUserState</key> | ||
<dict> | ||
<key>ICS4UTutorialTest.xcscheme</key> | ||
<dict> | ||
<key>orderHint</key> | ||
<integer>0</integer> | ||
</dict> | ||
</dict> | ||
<key>SuppressBuildableAutocreation</key> | ||
<dict> | ||
<key>132E14601D0C90680087BC6C</key> | ||
<dict> | ||
<key>primary</key> | ||
<true/> | ||
</dict> | ||
<key>132E14741D0C90690087BC6C</key> | ||
<dict> | ||
<key>primary</key> | ||
<true/> | ||
</dict> | ||
<key>132E147F1D0C90690087BC6C</key> | ||
<dict> | ||
<key>primary</key> | ||
<true/> | ||
</dict> | ||
</dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
// | ||
// AddReminderViewController.swift | ||
// ICS4UTutorialTest | ||
// | ||
// Created by Eric Qiu on 2016-06-11. | ||
// Copyright © 2016 Eric Qiu. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class AddReminderViewController: UIViewController, UITextFieldDelegate { | ||
var reminder: Reminder? | ||
|
||
@IBOutlet weak var reminderTextField: UITextField! | ||
@IBOutlet weak var timePicker: UIDatePicker! | ||
@IBOutlet weak var saveButton: UIBarButtonItem! | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
// Do any additional setup after loading the view. | ||
// set self as delegate for text field | ||
reminderTextField.delegate = self | ||
checkName() | ||
// set now as minimum date for picker | ||
timePicker.minimumDate = NSDate() | ||
timePicker.locale = NSLocale.currentLocale() | ||
} | ||
|
||
override func didReceiveMemoryWarning() { | ||
super.didReceiveMemoryWarning() | ||
// Dispose of any resources that can be recreated. | ||
} | ||
|
||
func checkName() { | ||
// Disable the Save button if the text field is empty. | ||
let text = reminderTextField.text ?? "" | ||
saveButton.enabled = !text.isEmpty | ||
} | ||
|
||
func checkDate() { | ||
// Disable the Save button if date has passed | ||
if NSDate().earlierDate(timePicker.date) == timePicker.date { | ||
saveButton.enabled = false | ||
} | ||
} | ||
|
||
// UITextFieldDelegate | ||
|
||
func textFieldShouldReturn(textField: UITextField) -> Bool { | ||
// Hide the keyboard. | ||
textField.resignFirstResponder() | ||
return true | ||
} | ||
|
||
func textFieldDidEndEditing(textField: UITextField) { | ||
checkName() | ||
navigationItem.title = textField.text | ||
} | ||
|
||
func textFieldDidBeginEditing(textField: UITextField) { | ||
// Disable the Save button while editing. | ||
saveButton.enabled = false | ||
} | ||
|
||
// UIDatePickerDelegate | ||
@IBAction func timeChanged(sender: UIDatePicker) { | ||
checkDate() | ||
} | ||
|
||
// Cancel button | ||
@IBAction func cancel(sender: UIBarButtonItem) { | ||
dismissViewControllerAnimated(true, completion: nil) | ||
} | ||
|
||
|
||
// MARK: - Navigation | ||
|
||
// In a storyboard-based application, you will often want to do a little preparation before navigation | ||
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { | ||
// Get the new view controller using segue.destinationViewController. | ||
// Pass the selected object to the new view controller. | ||
|
||
if saveButton === sender { | ||
let name = reminderTextField.text | ||
var time = timePicker.date | ||
let timeInterval = floor(time.timeIntervalSinceReferenceDate/60)*60 | ||
time = NSDate(timeIntervalSinceReferenceDate: timeInterval) | ||
|
||
// build notification | ||
let notification = UILocalNotification() | ||
notification.alertTitle = "Reminder" | ||
notification.alertBody = "Don't forget to \(name!)!" | ||
notification.fireDate = time | ||
notification.soundName = UILocalNotificationDefaultSoundName | ||
|
||
UIApplication.sharedApplication().scheduleLocalNotification(notification) | ||
|
||
reminder = Reminder(name: name!, time: time, notification: notification) | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// AppDelegate.swift | ||
// ICS4UTutorialTest | ||
// | ||
// Created by Eric Qiu on 2016-06-11. | ||
// Copyright © 2016 Eric Qiu. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
@UIApplicationMain | ||
class AppDelegate: UIResponder, UIApplicationDelegate { | ||
|
||
var window: UIWindow? | ||
|
||
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | ||
// Override point for customization after application launch. | ||
application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: [.Alert, .Badge, .Sound], categories: nil)) | ||
return true | ||
} | ||
|
||
func application(application: UIApplication, didReceiveLocalNotification notification: UILocalNotification) { | ||
NotificationTableViewController().tableView.reloadData() | ||
} | ||
|
||
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 throttle down OpenGL ES frame rates. 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 inactive 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:. | ||
} | ||
|
||
|
||
} | ||
|
38 changes: 38 additions & 0 deletions
38
ICS4UTutorialTest/Assets.xcassets/AppIcon.appiconset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "29x29", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "29x29", | ||
"scale" : "3x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "40x40", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "40x40", | ||
"scale" : "3x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "60x60", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "60x60", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM"> | ||
<dependencies> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/> | ||
</dependencies> | ||
<scenes> | ||
<!--View Controller--> | ||
<scene sceneID="EHf-IW-A2E"> | ||
<objects> | ||
<viewController id="01J-lp-oVM" sceneMemberID="viewController"> | ||
<layoutGuides> | ||
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/> | ||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/> | ||
</layoutGuides> | ||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> | ||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/> | ||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
<animations/> | ||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> | ||
</view> | ||
</viewController> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> | ||
</objects> | ||
<point key="canvasLocation" x="53" y="375"/> | ||
</scene> | ||
</scenes> | ||
</document> |
Oops, something went wrong.