Skip to content

Commit

Permalink
complete Project 26 - 3DTouchDemo
Browse files Browse the repository at this point in the history
  • Loading branch information
cjiong committed Jun 20, 2016
1 parent 9314979 commit 1fbb7d4
Show file tree
Hide file tree
Showing 11 changed files with 196 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@
TargetAttributes = {
19B7A9551D14274B00F62CCC = {
CreatedOnToolsVersion = 7.2;
DevelopmentTeam = 55TJDVV762;
};
19B7A9691D14274B00F62CCC = {
CreatedOnToolsVersion = 7.2;
Expand Down Expand Up @@ -414,7 +413,9 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
INFOPLIST_FILE = "Project 26 - 3DTouchDemo/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "Jiong..Project-26---3DTouchDemo";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -425,7 +426,9 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
INFOPLIST_FILE = "Project 26 - 3DTouchDemo/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "Jiong..Project-26---3DTouchDemo";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,97 @@ import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {


enum ShortcutIdentifier: String {

case First
case Second
case Third

init?(fullType: String) {
guard let last = fullType.componentsSeparatedByString(".").last else { return nil }

self.init(rawValue: last)
}

var type: String {
return NSBundle.mainBundle().bundleIdentifier! + ".\(self.rawValue)"
}

}

var window: UIWindow?

var launchedShortCutItem: UIApplicationShortcutItem?

func handleShortCutItem(shortcutItem: UIApplicationShortcutItem) -> Bool {

var handled = false

guard ShortcutIdentifier(fullType: shortcutItem.type) != nil else { return false }

guard let shortCutType = shortcutItem.type as String? else { return false }

let storyboard = UIStoryboard(name: "Main", bundle: nil)

var vc = UIViewController()

switch (shortCutType) {

case ShortcutIdentifier.First.type:

vc = storyboard.instantiateViewControllerWithIdentifier("SceneryVC") as! SceneryViewController
handled = true
break

case ShortcutIdentifier.Second.type:

vc = storyboard.instantiateViewControllerWithIdentifier("CarVC") as! CarViewController
handled = true
break

case ShortcutIdentifier.Third.type:

vc = storyboard.instantiateViewControllerWithIdentifier("CartoonVC") as! CartoonViewController
handled = true
break

default:
break

}

window!.rootViewController?.presentViewController(vc, animated: true, completion: nil)

return handled

}

func application(application: UIApplication, performActionForShortcutItem shortcutItem: UIApplicationShortcutItem, completionHandler: (Bool) -> Void) {

let handledShortCutItem = handleShortCutItem(shortcutItem)
completionHandler(handledShortCutItem)
}

func applicationDidBecomeActive(application: UIApplication) {
guard let shortcut = launchedShortCutItem else { return }

handleShortCutItem(shortcut)
launchedShortCutItem = nil

}

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.

if let shortcutItem = launchOptions?[UIApplicationLaunchOptionsShortcutItemKey] as? UIApplicationShortcutItem {
launchedShortCutItem = shortcutItem
}

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 throttle down OpenGL ES frame rates. Games should use this method to pause the game.
Expand All @@ -33,10 +115,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// 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:.
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "car_112px_1195390_easyicon.net.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "cartoon_32px_572743_easyicon.net.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "scenery_65.344537815126px_1155521_easyicon.net.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"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.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<!--Scenery View Controller-->
<scene sceneID="fdZ-gd-Vvm">
<objects>
<viewController id="GRz-Hp-fj8" userLabel="Scenery View Controller" customClass="SceneryViewController" customModule="Project_26___3DTouchDemo" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="SceneryVC" id="GRz-Hp-fj8" userLabel="Scenery View Controller" customClass="SceneryViewController" customModule="Project_26___3DTouchDemo" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="9OH-3c-CgQ"/>
<viewControllerLayoutGuide type="bottom" id="WTx-Ts-0XM"/>
Expand All @@ -50,7 +50,7 @@
<!--Car View Controller-->
<scene sceneID="Y83-0w-nsT">
<objects>
<viewController id="aAi-AE-0nV" userLabel="Car View Controller" customClass="CarViewController" customModule="Project_26___3DTouchDemo" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="CarVC" id="aAi-AE-0nV" userLabel="Car View Controller" customClass="CarViewController" customModule="Project_26___3DTouchDemo" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="D4v-jZ-5ZZ"/>
<viewControllerLayoutGuide type="bottom" id="k87-tj-DsX"/>
Expand All @@ -74,7 +74,7 @@
<!--Cartoon View Controller-->
<scene sceneID="937-Ff-fZK">
<objects>
<viewController id="ijT-nC-tDr" userLabel="Cartoon View Controller" customClass="CartoonViewController" customModule="Project_26___3DTouchDemo" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="CartoonVC" id="ijT-nC-tDr" userLabel="Cartoon View Controller" customClass="CartoonViewController" customModule="Project_26___3DTouchDemo" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="uiY-yP-3ka"/>
<viewControllerLayoutGuide type="bottom" id="dBR-K7-fC7"/>
Expand Down
42 changes: 42 additions & 0 deletions Project 26 - 3DTouchDemo/Project 26 - 3DTouchDemo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,47 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIApplicationShortcutItems</key>
<array>
<dict>
<key>UIApplicationShortcutItemIconFile</key>
<string>scenery@1x</string>
<key>UIApplicationShortcutItemTitle</key>
<string>Scenery</string>
<key>UIApplicationShortcutItemType</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER).First</string>
<key>UIApplicationShortcutItemUserInfo</key>
<dict>
<key>firstShorcutKey1</key>
<string>firstShortcutKeyValue1</string>
</dict>
</dict>
<dict>
<key>UIApplicationShortcutItemIconFile</key>
<string>car@1x</string>
<key>UIApplicationShortcutItemTitle</key>
<string>Car</string>
<key>UIApplicationShortcutItemType</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER).Second</string>
<key>UIApplicationShortcutItemUserInfo</key>
<dict>
<key>secondShortcutKey1</key>
<string>secondShortcutValue1</string>
</dict>
</dict>
<dict>
<key>UIApplicationShortcutItemIconFile</key>
<string>cartoon@1x</string>
<key>UIApplicationShortcutItemTitle</key>
<string>Cartoon</string>
<key>UIApplicationShortcutItemType</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER).Third</string>
<key>UIApplicationShortcutItemUserInfo</key>
<dict>
<key>thirdShortcutValue1</key>
<string>thirdShortcutValue1</string>
</dict>
</dict>
</array>
</dict>
</plist>

0 comments on commit 1fbb7d4

Please sign in to comment.