Skip to content

Commit 62ed149

Browse files
committed
AdaptiveElements: Implementing Your Own Adaptive Design with UIKit: Version 1.0, 2016-09-13
First release This sample shows how to use UIKit to lay out your app's elements in different sizes, from full-screen on the smallest iPhone to Multitasking on the biggest iPad. It shows how to make smart decisions about implementing your own design. It also demonstrates how to reuse elements in different sizes, so you can take advantage of all the available space without having to rewrite your entire app. Signed-off-by: Liu Lantao <[email protected]>
1 parent aae0e24 commit 62ed149

File tree

18 files changed

+1217
-0
lines changed

18 files changed

+1217
-0
lines changed
Lines changed: 316 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,316 @@
1+
// !$*UTF8*$!
2+
{
3+
archiveVersion = 1;
4+
classes = {
5+
};
6+
objectVersion = 46;
7+
objects = {
8+
9+
/* Begin PBXBuildFile section */
10+
161C4B121CED2708007273A4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 161C4B111CED2708007273A4 /* AppDelegate.swift */; };
11+
161C4B161CED2708007273A4 /* SimpleExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 161C4B151CED2708007273A4 /* SimpleExampleViewController.swift */; };
12+
161C4B191CED2708007273A4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 161C4B171CED2708007273A4 /* Main.storyboard */; };
13+
161C4B1B1CED2708007273A4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 161C4B1A1CED2708007273A4 /* Assets.xcassets */; };
14+
161C4B1E1CED2708007273A4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 161C4B1C1CED2708007273A4 /* LaunchScreen.storyboard */; };
15+
161C4B261CED273A007273A4 /* ExampleContainerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 161C4B251CED273A007273A4 /* ExampleContainerViewController.swift */; };
16+
164B5AE21CFFECD000944B29 /* Design.swift in Sources */ = {isa = PBXBuildFile; fileRef = 164B5AE11CFFECD000944B29 /* Design.swift */; };
17+
16FCC0531CF4BAD10078E21A /* LargeElementViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16FCC0521CF4BAD10078E21A /* LargeElementViewController.swift */; };
18+
16FCC0551CF504410078E21A /* SmallElementViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16FCC0541CF504410078E21A /* SmallElementViewController.swift */; };
19+
/* End PBXBuildFile section */
20+
21+
/* Begin PBXFileReference section */
22+
161B5A2B1CF619EE00C6E9FE /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
23+
161C4B0E1CED2708007273A4 /* AdaptiveElements.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AdaptiveElements.app; sourceTree = BUILT_PRODUCTS_DIR; };
24+
161C4B111CED2708007273A4 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
25+
161C4B151CED2708007273A4 /* SimpleExampleViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimpleExampleViewController.swift; sourceTree = "<group>"; };
26+
161C4B181CED2708007273A4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
27+
161C4B1A1CED2708007273A4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
28+
161C4B1D1CED2708007273A4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
29+
161C4B1F1CED2708007273A4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
30+
161C4B251CED273A007273A4 /* ExampleContainerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExampleContainerViewController.swift; sourceTree = "<group>"; };
31+
164B5AE11CFFECD000944B29 /* Design.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Design.swift; sourceTree = "<group>"; };
32+
16FCC0521CF4BAD10078E21A /* LargeElementViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LargeElementViewController.swift; sourceTree = "<group>"; };
33+
16FCC0541CF504410078E21A /* SmallElementViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SmallElementViewController.swift; sourceTree = "<group>"; };
34+
/* End PBXFileReference section */
35+
36+
/* Begin PBXFrameworksBuildPhase section */
37+
161C4B0B1CED2708007273A4 /* Frameworks */ = {
38+
isa = PBXFrameworksBuildPhase;
39+
buildActionMask = 2147483647;
40+
files = (
41+
);
42+
runOnlyForDeploymentPostprocessing = 0;
43+
};
44+
/* End PBXFrameworksBuildPhase section */
45+
46+
/* Begin PBXGroup section */
47+
161C4B051CED2708007273A4 = {
48+
isa = PBXGroup;
49+
children = (
50+
161B5A2B1CF619EE00C6E9FE /* README.md */,
51+
161C4B101CED2708007273A4 /* AdaptiveElements */,
52+
161C4B0F1CED2708007273A4 /* Products */,
53+
);
54+
sourceTree = "<group>";
55+
};
56+
161C4B0F1CED2708007273A4 /* Products */ = {
57+
isa = PBXGroup;
58+
children = (
59+
161C4B0E1CED2708007273A4 /* AdaptiveElements.app */,
60+
);
61+
name = Products;
62+
sourceTree = "<group>";
63+
};
64+
161C4B101CED2708007273A4 /* AdaptiveElements */ = {
65+
isa = PBXGroup;
66+
children = (
67+
161C4B111CED2708007273A4 /* AppDelegate.swift */,
68+
161C4B151CED2708007273A4 /* SimpleExampleViewController.swift */,
69+
161C4B251CED273A007273A4 /* ExampleContainerViewController.swift */,
70+
164B5AE11CFFECD000944B29 /* Design.swift */,
71+
16FCC0541CF504410078E21A /* SmallElementViewController.swift */,
72+
16FCC0521CF4BAD10078E21A /* LargeElementViewController.swift */,
73+
161C4B171CED2708007273A4 /* Main.storyboard */,
74+
161C4B1A1CED2708007273A4 /* Assets.xcassets */,
75+
161C4B1C1CED2708007273A4 /* LaunchScreen.storyboard */,
76+
161C4B1F1CED2708007273A4 /* Info.plist */,
77+
);
78+
path = AdaptiveElements;
79+
sourceTree = "<group>";
80+
};
81+
/* End PBXGroup section */
82+
83+
/* Begin PBXNativeTarget section */
84+
161C4B0D1CED2708007273A4 /* AdaptiveElements */ = {
85+
isa = PBXNativeTarget;
86+
buildConfigurationList = 161C4B221CED2708007273A4 /* Build configuration list for PBXNativeTarget "AdaptiveElements" */;
87+
buildPhases = (
88+
161C4B0A1CED2708007273A4 /* Sources */,
89+
161C4B0B1CED2708007273A4 /* Frameworks */,
90+
161C4B0C1CED2708007273A4 /* Resources */,
91+
);
92+
buildRules = (
93+
);
94+
dependencies = (
95+
);
96+
name = AdaptiveElements;
97+
productName = AdaptiveElements;
98+
productReference = 161C4B0E1CED2708007273A4 /* AdaptiveElements.app */;
99+
productType = "com.apple.product-type.application";
100+
};
101+
/* End PBXNativeTarget section */
102+
103+
/* Begin PBXProject section */
104+
161C4B061CED2708007273A4 /* Project object */ = {
105+
isa = PBXProject;
106+
attributes = {
107+
LastSwiftUpdateCheck = 0800;
108+
LastUpgradeCheck = 0800;
109+
TargetAttributes = {
110+
161C4B0D1CED2708007273A4 = {
111+
CreatedOnToolsVersion = 8.0;
112+
ProvisioningStyle = Automatic;
113+
};
114+
};
115+
};
116+
buildConfigurationList = 161C4B091CED2708007273A4 /* Build configuration list for PBXProject "AdaptiveElements" */;
117+
compatibilityVersion = "Xcode 3.2";
118+
developmentRegion = English;
119+
hasScannedForEncodings = 0;
120+
knownRegions = (
121+
en,
122+
Base,
123+
);
124+
mainGroup = 161C4B051CED2708007273A4;
125+
productRefGroup = 161C4B0F1CED2708007273A4 /* Products */;
126+
projectDirPath = "";
127+
projectRoot = "";
128+
targets = (
129+
161C4B0D1CED2708007273A4 /* AdaptiveElements */,
130+
);
131+
};
132+
/* End PBXProject section */
133+
134+
/* Begin PBXResourcesBuildPhase section */
135+
161C4B0C1CED2708007273A4 /* Resources */ = {
136+
isa = PBXResourcesBuildPhase;
137+
buildActionMask = 2147483647;
138+
files = (
139+
161C4B1E1CED2708007273A4 /* LaunchScreen.storyboard in Resources */,
140+
161C4B1B1CED2708007273A4 /* Assets.xcassets in Resources */,
141+
161C4B191CED2708007273A4 /* Main.storyboard in Resources */,
142+
);
143+
runOnlyForDeploymentPostprocessing = 0;
144+
};
145+
/* End PBXResourcesBuildPhase section */
146+
147+
/* Begin PBXSourcesBuildPhase section */
148+
161C4B0A1CED2708007273A4 /* Sources */ = {
149+
isa = PBXSourcesBuildPhase;
150+
buildActionMask = 2147483647;
151+
files = (
152+
16FCC0551CF504410078E21A /* SmallElementViewController.swift in Sources */,
153+
16FCC0531CF4BAD10078E21A /* LargeElementViewController.swift in Sources */,
154+
161C4B161CED2708007273A4 /* SimpleExampleViewController.swift in Sources */,
155+
164B5AE21CFFECD000944B29 /* Design.swift in Sources */,
156+
161C4B121CED2708007273A4 /* AppDelegate.swift in Sources */,
157+
161C4B261CED273A007273A4 /* ExampleContainerViewController.swift in Sources */,
158+
);
159+
runOnlyForDeploymentPostprocessing = 0;
160+
};
161+
/* End PBXSourcesBuildPhase section */
162+
163+
/* Begin PBXVariantGroup section */
164+
161C4B171CED2708007273A4 /* Main.storyboard */ = {
165+
isa = PBXVariantGroup;
166+
children = (
167+
161C4B181CED2708007273A4 /* Base */,
168+
);
169+
name = Main.storyboard;
170+
sourceTree = "<group>";
171+
};
172+
161C4B1C1CED2708007273A4 /* LaunchScreen.storyboard */ = {
173+
isa = PBXVariantGroup;
174+
children = (
175+
161C4B1D1CED2708007273A4 /* Base */,
176+
);
177+
name = LaunchScreen.storyboard;
178+
sourceTree = "<group>";
179+
};
180+
/* End PBXVariantGroup section */
181+
182+
/* Begin XCBuildConfiguration section */
183+
161C4B201CED2708007273A4 /* Debug */ = {
184+
isa = XCBuildConfiguration;
185+
buildSettings = {
186+
ALWAYS_SEARCH_USER_PATHS = NO;
187+
CLANG_ANALYZER_NONNULL = YES;
188+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
189+
CLANG_CXX_LIBRARY = "libc++";
190+
CLANG_ENABLE_MODULES = YES;
191+
CLANG_ENABLE_OBJC_ARC = YES;
192+
CLANG_WARN_BOOL_CONVERSION = YES;
193+
CLANG_WARN_CONSTANT_CONVERSION = YES;
194+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
195+
CLANG_WARN_EMPTY_BODY = YES;
196+
CLANG_WARN_ENUM_CONVERSION = YES;
197+
CLANG_WARN_INT_CONVERSION = YES;
198+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
199+
CLANG_WARN_UNREACHABLE_CODE = YES;
200+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
201+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
202+
COPY_PHASE_STRIP = NO;
203+
DEBUG_INFORMATION_FORMAT = dwarf;
204+
ENABLE_STRICT_OBJC_MSGSEND = YES;
205+
ENABLE_TESTABILITY = YES;
206+
GCC_C_LANGUAGE_STANDARD = gnu99;
207+
GCC_DYNAMIC_NO_PIC = NO;
208+
GCC_NO_COMMON_BLOCKS = YES;
209+
GCC_OPTIMIZATION_LEVEL = 0;
210+
GCC_PREPROCESSOR_DEFINITIONS = (
211+
"DEBUG=1",
212+
"$(inherited)",
213+
);
214+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
215+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
216+
GCC_WARN_UNDECLARED_SELECTOR = YES;
217+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
218+
GCC_WARN_UNUSED_FUNCTION = YES;
219+
GCC_WARN_UNUSED_VARIABLE = YES;
220+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
221+
ONLY_ACTIVE_ARCH = YES;
222+
SDKROOT = iphoneos;
223+
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
224+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
225+
};
226+
name = Debug;
227+
};
228+
161C4B211CED2708007273A4 /* Release */ = {
229+
isa = XCBuildConfiguration;
230+
buildSettings = {
231+
ALWAYS_SEARCH_USER_PATHS = NO;
232+
CLANG_ANALYZER_NONNULL = YES;
233+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
234+
CLANG_CXX_LIBRARY = "libc++";
235+
CLANG_ENABLE_MODULES = YES;
236+
CLANG_ENABLE_OBJC_ARC = YES;
237+
CLANG_WARN_BOOL_CONVERSION = YES;
238+
CLANG_WARN_CONSTANT_CONVERSION = YES;
239+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
240+
CLANG_WARN_EMPTY_BODY = YES;
241+
CLANG_WARN_ENUM_CONVERSION = YES;
242+
CLANG_WARN_INT_CONVERSION = YES;
243+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
244+
CLANG_WARN_UNREACHABLE_CODE = YES;
245+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
246+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
247+
COPY_PHASE_STRIP = NO;
248+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
249+
ENABLE_NS_ASSERTIONS = NO;
250+
ENABLE_STRICT_OBJC_MSGSEND = YES;
251+
GCC_C_LANGUAGE_STANDARD = gnu99;
252+
GCC_NO_COMMON_BLOCKS = YES;
253+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
254+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
255+
GCC_WARN_UNDECLARED_SELECTOR = YES;
256+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
257+
GCC_WARN_UNUSED_FUNCTION = YES;
258+
GCC_WARN_UNUSED_VARIABLE = YES;
259+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
260+
SDKROOT = iphoneos;
261+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
262+
VALIDATE_PRODUCT = YES;
263+
};
264+
name = Release;
265+
};
266+
161C4B231CED2708007273A4 /* Debug */ = {
267+
isa = XCBuildConfiguration;
268+
buildSettings = {
269+
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
270+
INFOPLIST_FILE = AdaptiveElements/Info.plist;
271+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
272+
PRODUCT_BUNDLE_IDENTIFIER = "com.example.apple-samplecode.AdaptiveElements";
273+
PRODUCT_NAME = "$(TARGET_NAME)";
274+
SWIFT_VERSION = 3.0;
275+
TARGETED_DEVICE_FAMILY = "1,2";
276+
};
277+
name = Debug;
278+
};
279+
161C4B241CED2708007273A4 /* Release */ = {
280+
isa = XCBuildConfiguration;
281+
buildSettings = {
282+
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
283+
INFOPLIST_FILE = AdaptiveElements/Info.plist;
284+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
285+
PRODUCT_BUNDLE_IDENTIFIER = "com.example.apple-samplecode.AdaptiveElements";
286+
PRODUCT_NAME = "$(TARGET_NAME)";
287+
SWIFT_VERSION = 3.0;
288+
TARGETED_DEVICE_FAMILY = "1,2";
289+
};
290+
name = Release;
291+
};
292+
/* End XCBuildConfiguration section */
293+
294+
/* Begin XCConfigurationList section */
295+
161C4B091CED2708007273A4 /* Build configuration list for PBXProject "AdaptiveElements" */ = {
296+
isa = XCConfigurationList;
297+
buildConfigurations = (
298+
161C4B201CED2708007273A4 /* Debug */,
299+
161C4B211CED2708007273A4 /* Release */,
300+
);
301+
defaultConfigurationIsVisible = 0;
302+
defaultConfigurationName = Release;
303+
};
304+
161C4B221CED2708007273A4 /* Build configuration list for PBXNativeTarget "AdaptiveElements" */ = {
305+
isa = XCConfigurationList;
306+
buildConfigurations = (
307+
161C4B231CED2708007273A4 /* Debug */,
308+
161C4B241CED2708007273A4 /* Release */,
309+
);
310+
defaultConfigurationIsVisible = 0;
311+
defaultConfigurationName = Release;
312+
};
313+
/* End XCConfigurationList section */
314+
};
315+
rootObject = 161C4B061CED2708007273A4 /* Project object */;
316+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
Copyright (C) 2016 Apple Inc. All Rights Reserved.
3+
See LICENSE.txt for this sample’s licensing information
4+
5+
Abstract:
6+
The application's delegate. In this app, it does nothing interesting, it only stores the app's window.
7+
*/
8+
9+
import UIKit
10+
11+
@UIApplicationMain
12+
class AppDelegate: UIResponder, UIApplicationDelegate {
13+
14+
var window: UIWindow?
15+
16+
}
17+

0 commit comments

Comments
 (0)