Skip to content

Commit 8d84829

Browse files
committed
Flags: A demonstration of automatic RTL support in Asset Catalogs and UIStackViews: Version 1.0, 2016-10-27
First release This sample project illustrates the usage of Directional Image Assets in an iOS project. By using Directional Image Assets, images shown on-screen can automatically adapt to different layout directions (e.g. right-to-left contexts when running in Arabic or Hebrew), without requiring special code for loading different image variations at runtime. Signed-off-by: Liu Lantao <[email protected]>
1 parent 8c9a363 commit 8d84829

33 files changed

+1041
-0
lines changed

Flags/Flags.xcodeproj/project.pbxproj

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

Flags/Flags/AppDelegate.swift

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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 delegate subclass of the Flags app.
7+
*/
8+
9+
import UIKit
10+
11+
@UIApplicationMain
12+
class AppDelegate: UIResponder, UIApplicationDelegate {
13+
14+
var window: UIWindow?
15+
}

0 commit comments

Comments
 (0)