Skip to content

Commit c560e33

Browse files
NavigationController with Segue
The screens presented by a navigation interface typically mimic the hierarchical organization of your data. At each level of the hierarchy, you provide an appropriate screen (managed by a custom view controller) to display the content at that level. Figure 1 shows an example of the navigation interface presented by the Settings application in iOS Simulator. The first screen presents the user with the list of applications that contain preferences. Selecting an application reveals individual settings and groups of settings for that application. Selecting a group yields more settings and so on. For all but the root view, the navigation controller provides a back button to allow the user to move back up the hierarchy.
1 parent 02148bf commit c560e33

File tree

8 files changed

+676
-0
lines changed

8 files changed

+676
-0
lines changed
Lines changed: 298 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,298 @@
1+
// !$*UTF8*$!
2+
{
3+
archiveVersion = 1;
4+
classes = {
5+
};
6+
objectVersion = 46;
7+
objects = {
8+
9+
/* Begin PBXBuildFile section */
10+
A70C8B501E43245A00CB8D49 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A70C8B4F1E43245A00CB8D49 /* AppDelegate.swift */; };
11+
A70C8B521E43245A00CB8D49 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A70C8B511E43245A00CB8D49 /* ViewController.swift */; };
12+
A70C8B551E43245A00CB8D49 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A70C8B531E43245A00CB8D49 /* Main.storyboard */; };
13+
A70C8B571E43245B00CB8D49 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A70C8B561E43245B00CB8D49 /* Assets.xcassets */; };
14+
A70C8B621E43262600CB8D49 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A70C8B611E43262600CB8D49 /* LaunchScreen.storyboard */; };
15+
/* End PBXBuildFile section */
16+
17+
/* Begin PBXFileReference section */
18+
A70C8B4C1E43245A00CB8D49 /* NavigationControllerDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NavigationControllerDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
19+
A70C8B4F1E43245A00CB8D49 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
20+
A70C8B511E43245A00CB8D49 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
21+
A70C8B541E43245A00CB8D49 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
22+
A70C8B561E43245B00CB8D49 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
23+
A70C8B5B1E43245B00CB8D49 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
24+
A70C8B611E43262600CB8D49 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
25+
/* End PBXFileReference section */
26+
27+
/* Begin PBXFrameworksBuildPhase section */
28+
A70C8B491E43245A00CB8D49 /* Frameworks */ = {
29+
isa = PBXFrameworksBuildPhase;
30+
buildActionMask = 2147483647;
31+
files = (
32+
);
33+
runOnlyForDeploymentPostprocessing = 0;
34+
};
35+
/* End PBXFrameworksBuildPhase section */
36+
37+
/* Begin PBXGroup section */
38+
A70C8B431E43245A00CB8D49 = {
39+
isa = PBXGroup;
40+
children = (
41+
A70C8B4E1E43245A00CB8D49 /* NavigationControllerDemo */,
42+
A70C8B4D1E43245A00CB8D49 /* Products */,
43+
);
44+
sourceTree = "<group>";
45+
};
46+
A70C8B4D1E43245A00CB8D49 /* Products */ = {
47+
isa = PBXGroup;
48+
children = (
49+
A70C8B4C1E43245A00CB8D49 /* NavigationControllerDemo.app */,
50+
);
51+
name = Products;
52+
sourceTree = "<group>";
53+
};
54+
A70C8B4E1E43245A00CB8D49 /* NavigationControllerDemo */ = {
55+
isa = PBXGroup;
56+
children = (
57+
A70C8B4F1E43245A00CB8D49 /* AppDelegate.swift */,
58+
A70C8B511E43245A00CB8D49 /* ViewController.swift */,
59+
A70C8B531E43245A00CB8D49 /* Main.storyboard */,
60+
A70C8B561E43245B00CB8D49 /* Assets.xcassets */,
61+
A70C8B611E43262600CB8D49 /* LaunchScreen.storyboard */,
62+
A70C8B5B1E43245B00CB8D49 /* Info.plist */,
63+
);
64+
path = NavigationControllerDemo;
65+
sourceTree = "<group>";
66+
};
67+
/* End PBXGroup section */
68+
69+
/* Begin PBXNativeTarget section */
70+
A70C8B4B1E43245A00CB8D49 /* NavigationControllerDemo */ = {
71+
isa = PBXNativeTarget;
72+
buildConfigurationList = A70C8B5E1E43245B00CB8D49 /* Build configuration list for PBXNativeTarget "NavigationControllerDemo" */;
73+
buildPhases = (
74+
A70C8B481E43245A00CB8D49 /* Sources */,
75+
A70C8B491E43245A00CB8D49 /* Frameworks */,
76+
A70C8B4A1E43245A00CB8D49 /* Resources */,
77+
);
78+
buildRules = (
79+
);
80+
dependencies = (
81+
);
82+
name = NavigationControllerDemo;
83+
productName = NavigationControllerDemo;
84+
productReference = A70C8B4C1E43245A00CB8D49 /* NavigationControllerDemo.app */;
85+
productType = "com.apple.product-type.application";
86+
};
87+
/* End PBXNativeTarget section */
88+
89+
/* Begin PBXProject section */
90+
A70C8B441E43245A00CB8D49 /* Project object */ = {
91+
isa = PBXProject;
92+
attributes = {
93+
LastSwiftUpdateCheck = 0820;
94+
LastUpgradeCheck = 0820;
95+
ORGANIZATIONNAME = "Rajesh Dalsaniya";
96+
TargetAttributes = {
97+
A70C8B4B1E43245A00CB8D49 = {
98+
CreatedOnToolsVersion = 8.2.1;
99+
ProvisioningStyle = Automatic;
100+
};
101+
};
102+
};
103+
buildConfigurationList = A70C8B471E43245A00CB8D49 /* Build configuration list for PBXProject "NavigationControllerDemo" */;
104+
compatibilityVersion = "Xcode 3.2";
105+
developmentRegion = English;
106+
hasScannedForEncodings = 0;
107+
knownRegions = (
108+
en,
109+
Base,
110+
);
111+
mainGroup = A70C8B431E43245A00CB8D49;
112+
productRefGroup = A70C8B4D1E43245A00CB8D49 /* Products */;
113+
projectDirPath = "";
114+
projectRoot = "";
115+
targets = (
116+
A70C8B4B1E43245A00CB8D49 /* NavigationControllerDemo */,
117+
);
118+
};
119+
/* End PBXProject section */
120+
121+
/* Begin PBXResourcesBuildPhase section */
122+
A70C8B4A1E43245A00CB8D49 /* Resources */ = {
123+
isa = PBXResourcesBuildPhase;
124+
buildActionMask = 2147483647;
125+
files = (
126+
A70C8B621E43262600CB8D49 /* LaunchScreen.storyboard in Resources */,
127+
A70C8B571E43245B00CB8D49 /* Assets.xcassets in Resources */,
128+
A70C8B551E43245A00CB8D49 /* Main.storyboard in Resources */,
129+
);
130+
runOnlyForDeploymentPostprocessing = 0;
131+
};
132+
/* End PBXResourcesBuildPhase section */
133+
134+
/* Begin PBXSourcesBuildPhase section */
135+
A70C8B481E43245A00CB8D49 /* Sources */ = {
136+
isa = PBXSourcesBuildPhase;
137+
buildActionMask = 2147483647;
138+
files = (
139+
A70C8B521E43245A00CB8D49 /* ViewController.swift in Sources */,
140+
A70C8B501E43245A00CB8D49 /* AppDelegate.swift in Sources */,
141+
);
142+
runOnlyForDeploymentPostprocessing = 0;
143+
};
144+
/* End PBXSourcesBuildPhase section */
145+
146+
/* Begin PBXVariantGroup section */
147+
A70C8B531E43245A00CB8D49 /* Main.storyboard */ = {
148+
isa = PBXVariantGroup;
149+
children = (
150+
A70C8B541E43245A00CB8D49 /* Base */,
151+
);
152+
name = Main.storyboard;
153+
sourceTree = "<group>";
154+
};
155+
/* End PBXVariantGroup section */
156+
157+
/* Begin XCBuildConfiguration section */
158+
A70C8B5C1E43245B00CB8D49 /* Debug */ = {
159+
isa = XCBuildConfiguration;
160+
buildSettings = {
161+
ALWAYS_SEARCH_USER_PATHS = NO;
162+
CLANG_ANALYZER_NONNULL = YES;
163+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
164+
CLANG_CXX_LIBRARY = "libc++";
165+
CLANG_ENABLE_MODULES = YES;
166+
CLANG_ENABLE_OBJC_ARC = YES;
167+
CLANG_WARN_BOOL_CONVERSION = YES;
168+
CLANG_WARN_CONSTANT_CONVERSION = YES;
169+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
170+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
171+
CLANG_WARN_EMPTY_BODY = YES;
172+
CLANG_WARN_ENUM_CONVERSION = YES;
173+
CLANG_WARN_INFINITE_RECURSION = YES;
174+
CLANG_WARN_INT_CONVERSION = YES;
175+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
176+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
177+
CLANG_WARN_UNREACHABLE_CODE = YES;
178+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
179+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
180+
COPY_PHASE_STRIP = NO;
181+
DEBUG_INFORMATION_FORMAT = dwarf;
182+
ENABLE_STRICT_OBJC_MSGSEND = YES;
183+
ENABLE_TESTABILITY = YES;
184+
GCC_C_LANGUAGE_STANDARD = gnu99;
185+
GCC_DYNAMIC_NO_PIC = NO;
186+
GCC_NO_COMMON_BLOCKS = YES;
187+
GCC_OPTIMIZATION_LEVEL = 0;
188+
GCC_PREPROCESSOR_DEFINITIONS = (
189+
"DEBUG=1",
190+
"$(inherited)",
191+
);
192+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
193+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
194+
GCC_WARN_UNDECLARED_SELECTOR = YES;
195+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
196+
GCC_WARN_UNUSED_FUNCTION = YES;
197+
GCC_WARN_UNUSED_VARIABLE = YES;
198+
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
199+
MTL_ENABLE_DEBUG_INFO = YES;
200+
ONLY_ACTIVE_ARCH = YES;
201+
SDKROOT = iphoneos;
202+
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
203+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
204+
TARGETED_DEVICE_FAMILY = "1,2";
205+
};
206+
name = Debug;
207+
};
208+
A70C8B5D1E43245B00CB8D49 /* Release */ = {
209+
isa = XCBuildConfiguration;
210+
buildSettings = {
211+
ALWAYS_SEARCH_USER_PATHS = NO;
212+
CLANG_ANALYZER_NONNULL = YES;
213+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
214+
CLANG_CXX_LIBRARY = "libc++";
215+
CLANG_ENABLE_MODULES = YES;
216+
CLANG_ENABLE_OBJC_ARC = YES;
217+
CLANG_WARN_BOOL_CONVERSION = YES;
218+
CLANG_WARN_CONSTANT_CONVERSION = YES;
219+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
220+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
221+
CLANG_WARN_EMPTY_BODY = YES;
222+
CLANG_WARN_ENUM_CONVERSION = YES;
223+
CLANG_WARN_INFINITE_RECURSION = YES;
224+
CLANG_WARN_INT_CONVERSION = YES;
225+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
226+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
227+
CLANG_WARN_UNREACHABLE_CODE = YES;
228+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
229+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
230+
COPY_PHASE_STRIP = NO;
231+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
232+
ENABLE_NS_ASSERTIONS = NO;
233+
ENABLE_STRICT_OBJC_MSGSEND = YES;
234+
GCC_C_LANGUAGE_STANDARD = gnu99;
235+
GCC_NO_COMMON_BLOCKS = YES;
236+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
237+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
238+
GCC_WARN_UNDECLARED_SELECTOR = YES;
239+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
240+
GCC_WARN_UNUSED_FUNCTION = YES;
241+
GCC_WARN_UNUSED_VARIABLE = YES;
242+
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
243+
MTL_ENABLE_DEBUG_INFO = NO;
244+
SDKROOT = iphoneos;
245+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
246+
TARGETED_DEVICE_FAMILY = "1,2";
247+
VALIDATE_PRODUCT = YES;
248+
};
249+
name = Release;
250+
};
251+
A70C8B5F1E43245B00CB8D49 /* Debug */ = {
252+
isa = XCBuildConfiguration;
253+
buildSettings = {
254+
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
255+
INFOPLIST_FILE = NavigationControllerDemo/Info.plist;
256+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
257+
PRODUCT_BUNDLE_IDENTIFIER = com.rajeshdalsaniya.NavigationControllerDemo;
258+
PRODUCT_NAME = "$(TARGET_NAME)";
259+
SWIFT_VERSION = 3.0;
260+
};
261+
name = Debug;
262+
};
263+
A70C8B601E43245B00CB8D49 /* Release */ = {
264+
isa = XCBuildConfiguration;
265+
buildSettings = {
266+
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
267+
INFOPLIST_FILE = NavigationControllerDemo/Info.plist;
268+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
269+
PRODUCT_BUNDLE_IDENTIFIER = com.rajeshdalsaniya.NavigationControllerDemo;
270+
PRODUCT_NAME = "$(TARGET_NAME)";
271+
SWIFT_VERSION = 3.0;
272+
};
273+
name = Release;
274+
};
275+
/* End XCBuildConfiguration section */
276+
277+
/* Begin XCConfigurationList section */
278+
A70C8B471E43245A00CB8D49 /* Build configuration list for PBXProject "NavigationControllerDemo" */ = {
279+
isa = XCConfigurationList;
280+
buildConfigurations = (
281+
A70C8B5C1E43245B00CB8D49 /* Debug */,
282+
A70C8B5D1E43245B00CB8D49 /* Release */,
283+
);
284+
defaultConfigurationIsVisible = 0;
285+
defaultConfigurationName = Release;
286+
};
287+
A70C8B5E1E43245B00CB8D49 /* Build configuration list for PBXNativeTarget "NavigationControllerDemo" */ = {
288+
isa = XCConfigurationList;
289+
buildConfigurations = (
290+
A70C8B5F1E43245B00CB8D49 /* Debug */,
291+
A70C8B601E43245B00CB8D49 /* Release */,
292+
);
293+
defaultConfigurationIsVisible = 0;
294+
};
295+
/* End XCConfigurationList section */
296+
};
297+
rootObject = A70C8B441E43245A00CB8D49 /* Project object */;
298+
}

swift-beginner-projects/NavigationControllerDemo/NavigationControllerDemo.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: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//
2+
// AppDelegate.swift
3+
// NavigationControllerDemo
4+
//
5+
// Created by Rajesh Dalsaniya on 02/02/17.
6+
// Copyright © 2017 Rajesh Dalsaniya. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
@UIApplicationMain
12+
class AppDelegate: UIResponder, UIApplicationDelegate {
13+
14+
var window: UIWindow?
15+
16+
17+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
18+
// Override point for customization after application launch.
19+
return true
20+
}
21+
22+
func applicationWillResignActive(_ application: UIApplication) {
23+
// 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.
24+
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
25+
}
26+
27+
func applicationDidEnterBackground(_ application: UIApplication) {
28+
// 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.
29+
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30+
}
31+
32+
func applicationWillEnterForeground(_ application: UIApplication) {
33+
// 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.
34+
}
35+
36+
func applicationDidBecomeActive(_ application: UIApplication) {
37+
// 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.
38+
}
39+
40+
func applicationWillTerminate(_ application: UIApplication) {
41+
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42+
}
43+
44+
45+
}
46+

0 commit comments

Comments
 (0)